473,773 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Google-API Bad-Gateway-Error

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 incompatibiliti es 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.setLicen se('xxxxxxxxxxx xxxxxx') ##removed ;-)
data = google.doGoogle Search('python' )
data.meta.searc hTime
data.results[0].URL
data.results[0].title
########

Full Traceback:
#############
Traceback (most recent call last):
File "test.py", line 3, in ?
data = google.doGoogle Search('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.H TTPError: <HTTPError 502 Bad Gateway>
#############

May 16 '06 #1
4 3151
Di**********@ma il.com wrote:
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.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
May 16 '06 #2
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

May 16 '06 #3
Di**********@ma il.com wrote:
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.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
May 16 '06 #4
On Tue, May 16, 2006 at 01:24:25PM +0000, John Bokma wrote:
Di**********@ma il.com wrote:
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.


Yup, me too.

retries = 0
while (retries < 5):
try:
gpage = google.doGoogle Search(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
May 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2990
by: Brian Murphy | last post by:
I own a PHP-based website.I want to encrypt the HTML output.That will for sure make the site unindexable by Google.Is there a way to encrypt the output to the users but not to Google.I suppose that if Google spider comes always from the same server,It would be easy: All I would need is the ip address(es) of that server?Please help.
13
2942
by: fuzzyman | last post by:
I've hacked together a 'GoogleCacheServer'. It is based on SimpleHTTPServer. Run the following script (hopefully google groups won't mangle the indentation) and set your browser proxy settings to 'localhost:8000'. It will let you browse the internet using google's cache. Obviously you'll miss images, javascript, css files, etc. See the world as google sees it ! (This is actually an 'inventive' short term measure to get round a...
19
3859
by: Christian Hvid | last post by:
Hello groups. I have a series of applet computer games on my homepage: http://vredungmand.dk/games/erik-spillet/index.html http://vredungmand.dk/games/nohats/index.html http://vredungmand.dk/games/platfoot/index.html http://vredungmand.dk/games/minorbug/index.html http://vredungmand.dk/games/timbuktu/index.html http://vredungmand.dk/games/taleban/index.html
3
4205
by: Alastair | last post by:
Hello guys, I've been building a search facility for an intranet site I'm part of developing and we've been building a search engine using Index Server. It mostly works, however there have been a few niggling problems and fixing it seems to be a case of patching errors as we find them so I'm thinking that it might be worth starting the logic from scratch and rebuilding this again. Basically we have a simple search, which is simply a...
25
2568
by: Tor Erik Sønvisen | last post by:
Hi I need to browse the socket-module source-code. I believe it's contained in the file socketmodule.c, but I can't locate this file... Where should I look? regards tores
9
2411
by: Ray5531 | last post by:
Sorry if this is irrelevant to this website,but I didn't find a better place to ask this question.I sent an email to google as well which I didn't recieve the answer.I'm creating a website and apparently the host hasn't registered me in googles search engine(I donnu why?) .I was rerading that if I add a Addsense program of google my webpage could be searchable and I earn money ,Is that right? Thanks
16
2582
by: Duncan Booth | last post by:
Google have announced a new service called 'Google App Engine' which may be of interest to some of the people here (although if you want to sign up you'll have to join the queue behind me): From the introduction: http://code.google.com/appengine
9
3599
by: maheswaran | last post by:
Hi all, I developed one application. From that application i created dynamic pages contact us , about us...(like joomla, but application is not in joomla)... These all are comes from database.In this i have one doubt, how google can indexing these pages from database or is google can able to indexing these pages. For easy, i posted this question into bytes-> forum and its stored in database. But if am googled then i can able to see this...
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.