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.__init__( self, name='doGetCachedPageResponse', ns='urn:GoogleSearch' )
179
180 -class doGoogleSearch (ZSI.TCcompound.Struct):
181 - def __init__(self, name=None, ns=None):
182 self._key = None 183 self._q = None 184 self._start = None 185 self._maxResults = None 186 self._filter = None 187 self._restrict = None 188 self._safeSearch = None 189 self._lr = None 190 self._ie = None 191 self._oe = None 192 193 oname = None 194 if name: 195 oname = name 196 if ns: 197 oname += ' xmlns="%s"' % ns 198 ZSI.TC.Struct.__init__(self, doGoogleSearch, [ZSI.TC.String(pname="key",aname="_key",optional=1),ZSI.TC.String(pname="q",aname="_q",optional=1),ZSI.TCnumbers.Iint(pname="start",aname="_start",optional=1),ZSI.TCnumbers.Iint(pname="maxResults",aname="_maxResults",optional=1),ZSI.TC.Boolean(pname="filter",aname="_filter",optional=1),ZSI.TC.String(pname="restrict",aname="_restrict",optional=1),ZSI.TC.Boolean(pname="safeSearch",aname="_safeSearch",optional=1),ZSI.TC.String(pname="lr",aname="_lr",optional=1),ZSI.TC.String(pname="ie",aname="_ie",optional=1),ZSI.TC.String(pname="oe",aname="_oe",optional=1),], pname=name, aname="_%s" % name, oname=oname )
199
200 -class doGoogleSearchWrapper(doGoogleSearch):
201 """wrapper for rpc:encoded message""" 202 203 typecode = doGoogleSearch(name='doGoogleSearch', ns='urn:GoogleSearch')
204 - def __init__( self, name=None, ns=None ):
205 doGoogleSearch.__init__( self, name='doGoogleSearch', ns='urn:GoogleSearch' )
206
207 -class doGoogleSearchResponse (ZSI.TCcompound.Struct):
208 - def __init__(self, name=None, ns=None):
209 self._return = ns1.GoogleSearchResult_Def() 210 211 oname = None 212 if name: 213 oname = name 214 if ns: 215 oname += ' xmlns="%s"' % ns 216 ZSI.TC.Struct.__init__(self, doGoogleSearchResponse, [ns1.GoogleSearchResult_Def( name="return", ns=ns ),], pname=name, aname="_%s" % name, oname=oname )
217
218 -class doGoogleSearchResponseWrapper(doGoogleSearchResponse):
219 """wrapper for rpc:encoded message""" 220 221 typecode = doGoogleSearchResponse(name='doGoogleSearchResponse', ns='urn:GoogleSearch')
222 - def __init__( self, name=None, ns=None ):
223 doGoogleSearchResponse.__init__( self, name='doGoogleSearchResponse', ns='urn:GoogleSearch' )
224
225 -class doSpellingSuggestion (ZSI.TCcompound.Struct):
226 - def __init__(self, name=None, ns=None):
227 self._key = None 228 self._phrase = None 229 230 oname = None 231 if name: 232 oname = name 233 if ns: 234 oname += ' xmlns="%s"' % ns 235 ZSI.TC.Struct.__init__(self, doSpellingSuggestion, [ZSI.TC.String(pname="key",aname="_key",optional=1),ZSI.TC.String(pname="phrase",aname="_phrase",optional=1),], pname=name, aname="_%s" % name, oname=oname )
236
237 -class doSpellingSuggestionWrapper(doSpellingSuggestion):
238 """wrapper for rpc:encoded message""" 239 240 typecode = doSpellingSuggestion(name='doSpellingSuggestion', ns='urn:GoogleSearch')
241 - def __init__( self, name=None, ns=None ):
242 doSpellingSuggestion.__init__( self, name='doSpellingSuggestion', ns='urn:GoogleSearch' )
243
244 -class doSpellingSuggestionResponse (ZSI.TCcompound.Struct):
245 - def __init__(self, name=None, ns=None):
246 self._return = None 247 248 oname = None 249 if name: 250 oname = name 251 if ns: 252 oname += ' xmlns="%s"' % ns 253 ZSI.TC.Struct.__init__(self, doSpellingSuggestionResponse, [ZSI.TC.String(pname="return",aname="_return",optional=1),], pname=name, aname="_%s" % name, oname=oname )
254
255 -class doSpellingSuggestionResponseWrapper(doSpellingSuggestionResponse):
256 """wrapper for rpc:encoded message""" 257 258 typecode = doSpellingSuggestionResponse(name='doSpellingSuggestionResponse', ns='urn:GoogleSearch')
259 - def __init__( self, name=None, ns=None ):
260 doSpellingSuggestionResponse.__init__( self, name='doSpellingSuggestionResponse', ns='urn:GoogleSearch' )
261