Google-API Bad-Gateway-Error

D

DierkErdmann

Hi,

I am trying to query google from within a python script using the
Google-Api (pygoogle).
The following piece of codes gives me a "SOAPpy.Errors.HTTPError:
<HTTPError 502 Bad Gateway>", the full Traceback is shown below. I am
aware of the incompatibilities between the Google-Api and older
versions of the SOAP-Library; I do have installed a recent version of
SOAP (v. 0.11.3) which is said to be supported by Google-API.

Can someone help?
TIA
Dierk

Source-Code:
######
import google
google.setLicense('xxxxxxxxxxxxxxxxx') ##removed ;-)
data = google.doGoogleSearch('python')
data.meta.searchTime
data.results[0].URL
data.results[0].title
########

Full Traceback:
#############
Traceback (most recent call last):
File "test.py", line 3, in ?
data = google.doGoogleSearch('python')
File "/windows/g/Download/webcrawler/pygoogle-0.6/google.py", line
421, in doGoogleSearch
outputencoding )
File "/usr/lib/python2.4/site-packages/SOAPpy/Client.py", line 421,
in __call__
return self.__r_call(*args, **kw)
File "/usr/lib/python2.4/site-packages/SOAPpy/Client.py", line 443,
in __r_call
self.__hd, self.__ma)
File "/usr/lib/python2.4/site-packages/SOAPpy/Client.py", line 345,
in __call
config = self.config)
File "/usr/lib/python2.4/site-packages/SOAPpy/Client.py", line 249,
in call
raise HTTPError(code, msg)
SOAPpy.Errors.HTTPError: <HTTPError 502 Bad Gateway>
#############
 
J

John Bokma

Hi,

I am trying to query google from within a python script using the
Google-Api (pygoogle).
The following piece of codes gives me a "SOAPpy.Errors.HTTPError:
<HTTPError 502 Bad Gateway>",

Not with Python, but with Perl, I am seeing now and then the same error.
If you rerun the script, does the message go away?

A week or 2-3 ago I had even the feeling that the Google API was gone for
about a day.
 
D

DierkErdmann

It's quite strange, after calling the script several times it started
to work; but sometimes the error occurs again. Maybe google has
technical probs.

Dierk
 
J

John Bokma

It's quite strange, after calling the script several times it started
to work; but sometimes the error occurs again. Maybe google has
technical probs.

Yup, I've seen exactly the same behavoir. So now I do several retry -
sleep - retry steps before giving up.
 
J

Jack Diederich

Yup, I've seen exactly the same behavoir. So now I do several retry -
sleep - retry steps before giving up.

Yup, me too.

retries = 0
while (retries < 5):
try:
gpage = google.doGoogleSearch(keyword, start=start)
break
except:
retries += 1
time.sleep(30)
else:
raise # chronic failure, reraise the last error

The job runs nightly at O'Dark thirty.
I get one chronic failure every few months.

-Jack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top