Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Google API - 502 Bad Gateway Error

23 views
Skip to first unread message

bashar....@gmail.com

unread,
Jan 4, 2006, 11:54:28 AM1/4/06
to
Hi,

I am running a simple perl script in a loop as a work around for the 10
results limit. The script has been tested and is working fine. But the
problem is, I started getting the 502 Bad Gateway Error lately and this
is causing the program to terminate ruining my searching.

Is there anyway I can handle this error, and resume the program if it
occurs? Any suggestions are highly appreciated.

Thanks

janine

unread,
Jan 5, 2006, 3:21:38 AM1/5/06
to
hi bashar,

a couple of others were having the same problem see
http://groups.google.com/group/google.public.web-apis/browse_thread/thread/bcbaf3a22db42126/9c1929441a8667bc#9c1929441a8667bc

my api errors seem to have vanished today. are you still having issues?

bashar....@gmail.com

unread,
Jan 5, 2006, 5:59:28 PM1/5/06
to
Hi Janine,

Thanks for the link. I have already seen it. I am still facing the same
problem, and it seems something related to stability of service. Its
still Beta you know.

Anyhow, I rewrote the script using Java and am able to handle the error
now. Its still occuring, but at least the program moves on.

thanks

Roger

unread,
Jan 6, 2006, 5:07:29 PM1/6/06
to
To get around the problem you could do something like:

$receivedError = 0;
$maxErrorsAllowed = 15;
do {
eval {
$googleResults =
$soap->doGoogleSearch($googlekey, $query,

(10*$loopCount), 10,

"true", "", "false", "",

"latin1", "latin1"
);
};

if ( $@ ) {
$receivedError++;
sleep(15);
} else {
$receivedError = 0;
}
} while ( $receivedError && ($receivedError <= $maxErrorsAllowed) );

This will capture any Google error, sleep for 15 seconds, and then
retry up to 15 times. It has been working great for me. Hope this
helps.

Roger

Roger

unread,
Jan 6, 2006, 4:26:01 PM1/6/06
to

(10*$loopCount), 10, "true",

Roger

bashar....@gmail.com

unread,
Jan 9, 2006, 8:21:50 AM1/9/06
to
Thanks very much for the info. Thats exactly what I needed for the perl
program.

Appreciate it.

Bashar

0 new messages