Module GoogleSearch_services
[hide private]
[frames] | no frames]

Source Code for Module GoogleSearch_services

  1  ##################################################  
  2  # GoogleSearch_services.py  
  3  # generated by ZSI.wsdl2python  
  4  #  
  5  #  
  6  ################################################## 
  7   
  8   
  9  from GoogleSearch_services_types import * 
 10  from GoogleSearch_services_types import \ 
 11      urn_GoogleSearch as ns1 
 12  import urlparse, types 
 13  from ZSI.TCcompound import Struct 
 14  from ZSI import client 
 15  import ZSI 
 16   
18 - def getGoogleSearchPort(self, portAddress=None, **kw):
19 raise NonImplementationError, "method not implemented"
20 21
22 -class GoogleSearchServiceLocator(GoogleSearchServiceInterface):
23 GoogleSearchPort_address = "http://api.google.com/search/beta2" 26
27 - def getGoogleSearchPort(self, portAddress=None, **kw):
29 30
32
33 - def __init__(self, addr, **kw):
34 netloc = (urlparse.urlparse(addr)[1]).split(":") + [80,] 35 if not kw.has_key("host"): 36 kw["host"] = netloc[0] 37 if not kw.has_key("port"): 38 kw["port"] = int(netloc[1]) 39 if not kw.has_key("url"): 40 kw["url"] = urlparse.urlparse(addr)[2] 41 self.binding = client.Binding(**kw)
42 43
44 - def doGetCachedPage(self, request):
45 """ 46 @param: request to doGetCachedPage:: 47 _key: str 48 _url: str 49 50 @return: response from doGetCachedPageResponse:: 51 _return: str 52 """ 53 54 if not isinstance(request, doGetCachedPage) and\ 55 not issubclass(doGetCachedPage, request.__class__): 56 raise TypeError, "%s incorrect request type" %(request.__class__) 57 kw = {} 58 response = self.binding.Send(None, None, request, soapaction="urn:GoogleSearchAction", **kw) 59 response = self.binding.Receive(doGetCachedPageResponseWrapper()) 60 if not isinstance(response, doGetCachedPageResponse) and\ 61 not issubclass(doGetCachedPageResponse, response.__class__): 62 raise TypeError, "%s incorrect response type" %(response.__class__) 63 return response
64 65
66 - def doGoogleSearch(self, request):
67 """ 68 @param: request to doGoogleSearch:: 69 _filter: boolean 70 _ie: str 71 _key: str 72 _lr: str 73 _maxResults: int 74 _oe: str 75 _q: str 76 _restrict: str 77 _safeSearch: boolean 78 _start: int 79 80 @return: response from doGoogleSearchResponse:: 81 _return: ns1.GoogleSearchResult_Def 82 _directoryCategories: ns1.DirectoryCategoryArray_Def 83 _element: ns1.DirectoryCategory_Def 84 _fullViewableName: str 85 _specialEncoding: str 86 _documentFiltering: boolean 87 _endIndex: int 88 _estimateIsExact: boolean 89 _estimatedTotalResultsCount: int 90 _resultElements: ns1.ResultElementArray_Def 91 _element: ns1.ResultElement_Def 92 _URL: str 93 _cachedSize: str 94 _directoryCategory: ns1.DirectoryCategory_Def 95 _directoryTitle: str 96 _hostName: str 97 _relatedInformationPresent: boolean 98 _snippet: str 99 _summary: str 100 _title: str 101 _searchComments: str 102 _searchQuery: str 103 _searchTime: float 104 _searchTips: str 105 _startIndex: int 106 """ 107 108 if not isinstance(request, doGoogleSearch) and\ 109 not issubclass(doGoogleSearch, request.__class__): 110 raise TypeError, "%s incorrect request type" %(request.__class__) 111 kw = {} 112 response = self.binding.Send(None, None, request, soapaction="urn:GoogleSearchAction", **kw) 113 response = self.binding.Receive(doGoogleSearchResponseWrapper()) 114 if not isinstance(response, doGoogleSearchResponse) and\ 115 not issubclass(doGoogleSearchResponse, response.__class__): 116 raise TypeError, "%s incorrect response type" %(response.__class__) 117 return response
118 119
120 - def doSpellingSuggestion(self, request):
121 """ 122 @param: request to doSpellingSuggestion:: 123 _key: str 124 _phrase: str 125 126 @return: response from doSpellingSuggestionResponse:: 127 _return: str 128 """ 129 130 if not isinstance(request, doSpellingSuggestion) and\ 131 not issubclass(doSpellingSuggestion, request.__class__): 132 raise TypeError, "%s incorrect request type" %(request.__class__) 133 kw = {} 134 response = self.binding.Send(None, None, request, soapaction="urn:GoogleSearchAction", **kw) 135 response = self.binding.Receive(doSpellingSuggestionResponseWrapper()) 136 if not isinstance(response, doSpellingSuggestionResponse) and\ 137 not issubclass(doSpellingSuggestionResponse, response.__class__): 138 raise TypeError, "%s incorrect response type" %(response.__class__) 139 return response
140 141 142
143 -class doGetCachedPage (ZSI.TCcompound.Struct):
144 - def __init__(self, name=None, ns=None):
145 self._key = None 146 self._url = None 147 148 oname = None 149 if name: 150 oname = name 151 if ns: 152 oname += ' xmlns="%s"' % ns 153 ZSI.TC.Struct.__init__(self, doGetCachedPage, [ZSI.TC.String(pname="key",aname="_key",optional=1),ZSI.TC.String(pname="url",aname="_url",optional=1),], pname=name, aname="_%s" % name, oname=oname )
154
155 -class doGetCachedPageWrapper(doGetCachedPage):
156 """wrapper for rpc:encoded message""" 157 158 typecode = doGetCachedPage(name='doGetCachedPage', ns='urn:GoogleSearch')
159 - def __init__( self, name=None, ns=None ):
160 doGetCachedPage.__init__( self, name='doGetCachedPage', ns='urn:GoogleSearch' )
161
162 -class doGetCachedPageResponse (ZSI.TCcompound.Struct):
163 - def __init__(self, name=None, ns=None):
164 self._return = None 165 166 oname = None 167 if name: 168 oname = name 169 if ns: 170 oname += ' xmlns="%s"' % ns 171 ZSI.TC.Struct.__init__(self, doGetCachedPageResponse, [ZSI.TC.Base64String(pname="return",aname="_return",optional=1),], pname=name, aname="_%s" % name, oname=oname )
172
173 -class doGetCachedPageResponseWrapper(doGetCachedPageResponse):
174 """wrapper for rpc:encoded message""" 175 176 typecode = doGetCachedPageResponse(name='doGetCachedPageResponse', ns='urn:GoogleSearch')
177 - def __init__( self, name=None, ns=None ):
178 doGetCachedPageResponse.