and patched to work with the current SOAPpy the only change in this releas: - fixed small typo in documentation
79 lines
3.1 KiB
Text
79 lines
3.1 KiB
Text
$NetBSD: patch-aa,v 1.3 2003/12/24 11:44:08 recht Exp $
|
|
|
|
--- google.py.orig 2003-06-18 11:17:06.000000000 +0200
|
|
+++ google.py 2003-12-24 12:38:27.000000000 +0100
|
|
@@ -43,7 +43,8 @@
|
|
Erik Max Francis, for the command line interface
|
|
Michael Twomey, for HTTP proxy support"""
|
|
|
|
-import SOAP
|
|
+from SOAPpy import SOAPProxy
|
|
+from SOAPpy import Types
|
|
import os, sys, getopt
|
|
|
|
LICENSE_KEY = None
|
|
@@ -53,8 +54,8 @@
|
|
class NoLicenseKey(Exception): pass
|
|
_url = 'http://api.google.com/search/beta2'
|
|
_namespace = 'urn:GoogleSearch'
|
|
-_false = SOAP.booleanType(0)
|
|
-_true = SOAP.booleanType(1)
|
|
+_false = Types.booleanType(0)
|
|
+_true = Types.booleanType(1)
|
|
_googlefile1 = ".googlekey"
|
|
_googlefile2 = "googlekey.txt"
|
|
_licenseLocations = (
|
|
@@ -201,11 +202,11 @@
|
|
class _SearchBase:
|
|
def __init__(self, params):
|
|
for k, v in params.items():
|
|
- if isinstance(v, SOAP.structType):
|
|
- v = v._asdict
|
|
+ if isinstance(v, Types.structType):
|
|
+ v = v._asdict()
|
|
try:
|
|
- if isinstance(v[0], SOAP.structType):
|
|
- v = [node._asdict for node in v]
|
|
+ if isinstance(v[0], Types.structType):
|
|
+ v = [node._asdict() for node in v]
|
|
except:
|
|
pass
|
|
self.__dict__[str(k)] = v
|
|
@@ -303,16 +304,16 @@
|
|
See documentation of these individual classes for list of available attributes
|
|
"""
|
|
http_proxy = getProxy(http_proxy)
|
|
- remoteserver = SOAP.SOAPProxy(_url, namespace=_namespace, http_proxy=http_proxy)
|
|
+ remoteserver = SOAPProxy(_url, namespace=_namespace, http_proxy=http_proxy)
|
|
license_key = getLicense(license_key)
|
|
filter = _marshalBoolean(filter)
|
|
safeSearch = _marshalBoolean(safeSearch)
|
|
data = remoteserver.doGoogleSearch(license_key, q, start, maxResults, filter, restrict,
|
|
safeSearch, language, inputencoding, outputencoding)
|
|
- metadata = data._asdict
|
|
+ metadata = data._asdict()
|
|
del metadata["resultElements"]
|
|
metadata = SearchResultsMetaData(metadata)
|
|
- results = [SearchResult(node._asdict) for node in data.resultElements]
|
|
+ results = [SearchResult(node._asdict()) for node in data.resultElements]
|
|
return SearchReturnValue(metadata, results)
|
|
|
|
def doGetCachedPage(url, license_key = None, http_proxy = None):
|
|
@@ -330,7 +331,7 @@
|
|
Returns: string, text of cached page
|
|
"""
|
|
http_proxy = getProxy(http_proxy)
|
|
- remoteserver = SOAP.SOAPProxy(_url, namespace=_namespace, http_proxy=http_proxy)
|
|
+ remoteserver = SOAPProxy(_url, namespace=_namespace, http_proxy=http_proxy)
|
|
license_key = getLicense(license_key)
|
|
return remoteserver.doGetCachedPage(license_key, url)
|
|
|
|
@@ -348,7 +349,7 @@
|
|
Returns: text of suggested replacement, or None
|
|
"""
|
|
http_proxy = getProxy(http_proxy)
|
|
- remoteserver = SOAP.SOAPProxy(_url, namespace=_namespace, http_proxy=http_proxy)
|
|
+ remoteserver = SOAPProxy(_url, namespace=_namespace, http_proxy=http_proxy)
|
|
license_key = getLicense(license_key)
|
|
return remoteserver.doSpellingSuggestion(license_key, phrase)
|
|
|