Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #278 from zmwangx/please-please-dont-report-connec…
Browse files Browse the repository at this point in the history
…tion-blocked-as-bug

Better explain "Connection blocked due to unusual activity."
  • Loading branch information
jarun committed Apr 10, 2019
2 parents 5fd59b3 + 623615c commit 1d3f70d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion googler
Expand Up @@ -1989,7 +1989,17 @@ class GoogleConnection(object):
if resp.status in {301, 302, 303, 307, 308}:
redirection_url = resp.getheader('location', '')
if 'sorry/IndexRedirect?' in redirection_url or 'sorry/index?' in redirection_url:
raise GoogleConnectionError('Connection blocked due to unusual activity.')
msg = textwrap.dedent("""\
Connection blocked due to unusual activity.
THIS IS NOT A BUG, please do NOT report it as a bug unless you have specific
information that may lead to the development of a workaround.
You IP address is temporarily or permanently blocked by Google and requires
reCAPTCHA-solving to use the service, which googler is not capable of.
Possible causes include issuing too many queries in a short time frame, or
operating from a shared / low reputation IP with a history of abuse.
Please do NOT use googler for automated scraping.""")
msg = " ".join(msg.splitlines())
raise GoogleConnectionError(msg)
self._redirect(redirection_url)
resp = self._resp
redirect_counter += 1
Expand Down

0 comments on commit 1d3f70d

Please sign in to comment.