Problems accessing the new Google Web APIs from Python
Simon Willison
simon at incutio.com
Fri Apr 12 05:16:26 EDT 2002
Google have just launched a new service - Google Web APIs - which allows
developers to query the google search engine via SOAP for non-commercial
use (you're allowed up to 1000 queries a day). To use the service you
have to sign up for a license key (all they ask for is an e-mail address
and password) and download the API package:
http://www.google.com/apis/
Anyway, I've been trying to get this working with Python (having never
used SOAP before) and I'm having problems, but I'm not sure if it's
their service going down or a problem with my code. I've grabbed the
SOAP module from here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pywebsvcs/SOAPpy/
And I'm running the following code in the Python interactive prompt:
#######
import SOAP
key = 'my google license key here'
query = 'python'
s = SOAP.SOAPProxy("http://api.google.com/search/beta2")
r = s.doGoogleSearch(key, query, 0, 10, "false", "", "false", "",
"latin1", "latin1")
Which results in the following error:
Traceback (most recent call last):
File "<pyshell#19>", line 1, in ?
r = s.doGoogleSearch(key, query, 0, 10, "false", "", "false", "",
"latin1", "latin1")
File "C:\Python22\lib\SOAP.py", line 3607, in __call__
return self.__r_call(*args, **kw)
File "C:\Python22\lib\SOAP.py", line 3627, in __r_call
self.__hd, self.__ma)
File "C:\Python22\lib\SOAP.py", line 3536, in __call
config = self.config)
File "C:\Python22\lib\SOAP.py", line 3471, in call
raise HTTPError(code, msg)
HTTPError: <HTTPError 500 Internal Server Error>
#######
Does this mean their web server is dead (from the load of all the
enthusiastic developers trying out the new service) or am I just getting
my SOAP usage wrong?
The example for using Perl that comes with the Web API package suggests
getting the Perl SOAP::Lite package to load in the WSDL description file
for the Web API before doing anything. As far as I could tell the Python
SOAP module doesn't include support for WSDL (I may be wrong). Is this a
likely cause of my problem?
Cheers,
Simon Willison
More information about the Python-list
mailing list