googlesearch-python Not Working? Fix 429 Errors or Switch
Michael Carter · · 14 min read · Last updated

Key takeaways
- googlesearch-python 1.3.0 downloads google.com/search with plain HTTP requests, a random Lynx text-browser User-Agent and consent cookies, so Google sees an automated client from your IP address.
- The 429 error is Google's CAPTCHA page (google.com/sorry/) turned into an exception by raise_for_status(); the library never waits or retries.
- According to the project's issue tracker, Google has answered the library's Lynx User-Agent with an unsupported-browser page since September 10, 2025, so searches return an empty list without an error; no release since 1.3.0 (January 21, 2025) has fixed it.
- Pauses (sleep_interval of 5 seconds or more), fewer results per call and fewer runs reduce 429 errors, but no setting fixes empty results.
- Moving the same call to BestSERP takes about ten lines; all 36 links in our November 17, 2026 runs were Google redirects, but since a fix on November 18 polling returns final URLs, usually within 30 seconds, and domain or source names the site.
googlesearch-python stops working because it scrapes Google's results page from your own IP address. Search too fast and Google answers HTTP 429 with a CAPTCHA page. Since September 2025, Google has also refused the text-browser disguise the library relies on, so searches return empty lists. Pauses reduce 429 errors; only a search API fixes both problems.
This guide is for Python developers whose script broke. We read the library's source and its GitHub issues to show exactly what fails, list the fixes that still help, and move the same call to BestSERP, a Google SERP API, in about ten lines.
We did not run googlesearch-python against Google: firing unpaced automated queries at google.com from our own network is exactly the behavior this guide warns against. What follows comes from the code and the issue reports; the traceback is the library's own code, run against a local stand-in for Google.
Why googlesearch-python stops working: 429 and empty results
googlesearch-python fails because of how it works: it sends a plain HTTP request to google.com/search, presents itself as a text browser, and parses the HTML with Beautiful Soup. When Google blocks the request, you get a 429 exception; when Google answers with anything but a basic results page, you get an empty list.
It is an open-source library under the MIT license, not an official Google product. Version 1.3.0, released on January 21, 2025, is still the latest on PyPI (checked November 17, 2026). If an API that runs the search for you is a new idea, start with what a SERP API is and how it works.
How the library requests Google
From googlesearch/__init__.py and user_agents.py in version 1.3.0:
| Part | What one search() call sends or does |
|---|---|
| URL | GET https://www.google.com/search |
| Parameters | q, num (results wanted plus 2), hl, start, safe=active, and gl if you set region |
| User-Agent | A random Lynx string, such as Lynx/2.9.1 libwww-FM/2.13 SSL-MM/1.4 OpenSSL/2.3.6 |
| Cookies | CONSENT and SOCS, to skip the consent page |
| Timeout and pause | 5 seconds; sleep_interval after each page, 0 by default |
| Parsing | div.ezO2md blocks; link from /url?q=, title and snippet from two span classes |
| Errors | raise_for_status() raises requests.exceptions.HTTPError; no retry, no backoff |
There is no API key and no published quota: Google judges each request by your IP address and that User-Agent, and the parser depends on class names Google can change at any time.
The Lynx disguise arrived in 1.3.0. Version 1.2.5 sent ordinary Chrome and Firefox User-Agent strings and parsed div.g blocks. When Google began requiring JavaScript, contributors found it still served basic HTML to text browsers, and pull request #96 rebuilt the library around that.
Error 1: HTTPError 429 Too Many Requests
When Google decides traffic from your IP address looks automated, it redirects the search to its CAPTCHA page, google.com/sorry/, which answers with status 429. requests follows the redirect, and raise_for_status() turns the 429 into an exception:

That screenshot is a simulation we ran on November 17, 2026: the library's unmodified code, with every request answered by a local stub. The real error appears in issue #103 (January 28, 2025) with the same line numbers, 58 and 32, and the same /sorry/index?continue= URL.
googlesearch-python does not wait or retry after a 429. If your loop catches the exception and moves straight to the next query, it keeps hitting a CAPTCHA page that only a person can pass.
Error 2: an empty list and no error
The quieter failure is an empty list. If Google answers 200 with a page that has no ezO2md blocks, the loop stops and search() returns [] without raising anything; in our simulation, a stub page saying "Your browser isn't supported anymore" produced exactly that. It has happened on a large scale twice:
| Date | What changed | Effect on the library |
|---|---|---|
| January 16, 2025 | Google starts requiring JavaScript for Search (TechCrunch, January 17) | Empty lists; one log shows status 200 and no results (issue #95) |
| January 21, 2025 | Version 1.3.0 ships the Lynx User-Agent | Results return |
| September 10, 2025 | Google answers Lynx with "Your browser isn't supported anymore" (issue #113) | Empty lists for every query |
| October 2025 | Workarounds break again; the maintainer writes that "HTTP scraping does not work anymore" (issue #117) | No fix released |
| November 17, 2026 | 1.3.0 is still the latest release | Unchanged |
Going by the issue tracker, an empty list has been the normal result since September 2025.
Quick fixes to try first
If googlesearch-python still returns some results and only bursts fail with 429, five changes reduce how often Google blocks you. None of them fixes an empty list.
- Check which package you have.
pip show googlesearch-pythonshould report 1.3.0. The older package `google` (3.0.0, July 2020) also installs a module namedgooglesearch, whosesearch()takesnum,stopandpause. If Python imports that one,num_resultsfails withTypeError: search() got an unexpected keyword argument 'num_results'; runpip uninstall google. - Pause between requests. Pass
sleep_interval=5or more. In our simulation the library paused after every page, including the last, so back-to-back calls were spaced too: three pages and a second call went out within 0.02 seconds with the default of 0, and over 6 seconds withsleep_interval=2. - Ask for fewer results.
num_results=10normally takes one request (num=12). When a page holds 10 results, every further 10 is another request:num_results=30sent three in the simulation. - Run fewer searches. Reuse stored results, remove duplicate queries, and spread a batch over hours instead of minutes.
- Stop on the first 429. Catch
requests.exceptions.HTTPError, checkerr.response.status_code == 429, and end the batch. Google does not say how long a block lasts; the author of the Lynx patch advised users to "Retry in a few minutes or wait an hour" (pull request #96).
The pause and the small page together (the call we ran in the simulation):
from googlesearch import search # googlesearch-python 1.3.0
# 10 results is one request; the library then waits 5 seconds before returning
urls = list(search("python web scraping", num_results=10, lang="en", region="us", sleep_interval=5))
Why the fixes don't last
The quick fixes lower your request rate, but Google still sees the same thing: an automated client without JavaScript, from one IP address, naming a text browser.
- Google publishes no limit. A contributor who tried a browser-based version in December 2025 got about 20 requests through before blocks, and warned that "you may get blocked for several hours" (issue #117).
- The IP address sets the ceiling. googlesearch-python accepts
proxy=, but good addresses cost money: in our own browser-based tests, a home connection got about 70% of searches through, while 62 of 100 datacenter proxies never got a result in five tries. - The disguise is gone. No pause turns an "unsupported browser" page into results.
- The real fix is a different tool. The maintainer has asked for a headless browser mode, which turns a small requests-based library into a full scraper. We measured what that takes in why Google blocks scrapers, and what building one costs.
- The official fallback is closing. Contributors point to Google's Programmable Search Engine, but its Custom Search JSON API no longer accepts new customers; see the Custom Search JSON API alternatives.
Switching from googlesearch-python to an API (side-by-side code)
Switching takes about ten lines: replace the scraping call with one HTTPS request to a SERP API, which runs the search and returns Google's results as JSON. The function below keeps googlesearch-python's argument names, so the rest of your script stays as it is.
Before: googlesearch-python 1.3.0 (run only against our local stub, never against Google).
from googlesearch import search
urls = list(search("python web scraping", num_results=10, lang="en", region="us", sleep_interval=5))
After: BestSERP, tested on November 17, 2026 with Python 3.12.10 and requests 2.34.2.
import math
import os
import requests
def search(term, num_results=10, lang="en", region="us"):
resp = requests.post(
"https://api.bestserp.com/search",
headers={"X-API-KEY": os.environ["BESTSERP_API_KEY"]},
json={"q": term, "num": min(50, math.ceil(num_results / 10) * 10), "hl": lang, "gl": region},
timeout=130,
)
resp.raise_for_status()
return [r["link"] for r in resp.json()["organic"]][:num_results]
urls = search("python web scraping", num_results=10, lang="en", region="us")
How the arguments map:
| googlesearch-python | BestSERP /search |
Note |
|---|---|---|
term |
q |
1 to 256 characters |
num_results |
num |
10 to 50 in steps of 10; each 10 costs 1 credit |
lang, region |
hl, gl |
Language and country |
start_num |
page |
1 to 5; pages up to page are all charged |
advanced=True |
Always on | title, and usually snippet and domain |
sleep_interval, proxy |
Not needed | 60 searches a minute per account |
safe |
Not available | Unknown parameters get a 400 |
The caveat: links can be Google redirects
Our run returned nine links, and all nine were Google redirects (https://www.google.com/goto?url=...), not final page URLs. In the four responses we saved on November 17, 2026, all 36 organic links were redirects after link resolution had finished, and 16 of 36 results had no domain: results from sites such as Stack Overflow, Reddit, Medium and YouTube, where source names the site instead. The redirects were a link-resolution bug, fixed on November 18, 2026: in 61 searches through the public API that day, polling GET /requests/{requestId} turned all 401 pending redirects into final URLs, median 34 seconds and at most 54 seconds after the request.
The redirect links in the first answer work when opened (how link resolution works). Pick what your code needs:
- The site: return
r.get("domain") or r.get("source")instead ofr["link"]. - The final URL: poll
GET /requests/{requestId}whilelinksPendingis true, for up to 2 minutes, as the full code below does.unresolvedLinkscounts any links still left as redirects.
Full code with error handling
For a scheduled job, retry 502 and 503 (refunded), wait out 429 and poll 202. This version returns the result objects, after waiting up to 2 minutes for final links:
import math
import os
import sys
import time
import requests
API = "https://api.bestserp.com"
HEADERS = {"X-API-KEY": os.environ["BESTSERP_API_KEY"]}
def call(method, path, body=None, attempts=3):
for attempt in range(1, attempts + 1):
resp = requests.request(method, API + path, headers=HEADERS, json=body, timeout=130)
while resp.status_code == 202: # still running: poll the request ID (polling is free)
time.sleep(3)
resp = requests.get(f"{API}/requests/{resp.json()['requestId']}", headers=HEADERS, timeout=130)
if resp.status_code in (429, 502, 503): # rate limited (not charged), failed or busy (refunded)
print(f"attempt {attempt}: HTTP {resp.status_code}, retrying", file=sys.stderr)
time.sleep(int(resp.headers.get("Retry-After", 5)))
continue
resp.raise_for_status() # 400, 401, 402: fix the request or the account; never retry
return resp.json()
raise RuntimeError(f"{path}: no answer after {attempts} attempts")
def search(term, num_results=10, lang="en", region="us", wait_for_links=True):
"""Same arguments as googlesearch.search(); returns result dicts with link, domain and title."""
num = min(50, math.ceil(num_results / 10) * 10) # 10 to 50; every 10 results cost 1 credit
data = call("POST", "/search", {"q": term, "num": num, "hl": lang, "gl": region})
deadline = time.monotonic() + 120 # final URLs arrive by polling: usually within 30 s, up to 2 minutes
while wait_for_links and data.get("linksPending") and time.monotonic() < deadline:
time.sleep(4)
data = call("GET", f"/requests/{data['requestId']}")
return data["organic"][:num_results], data
def report(results, data):
for r in results: # domain is missing on some results (forums, videos): source names the site instead
print(r["position"], r.get("domain") or r.get("source", "-"), "|", r["link"][:48])
redirects = sum("google.com/goto" in r["link"] for r in results)
print(f"results: {len(results)} | without domain: {sum('domain' not in r for r in results)}"
f" | Google redirects: {redirects} | linksPending: {data.get('linksPending')}"
f" | credits: {data['credits']} | durationMs: {data['durationMs']}")
if __name__ == "__main__":
report(*search(sys.argv[1] if len(sys.argv) > 1 else "python web scraping"))
Our run on November 17, 2026 for "python google search library" (gl=us, hl=en):
1 Reddit · r/learnpython | https://www.google.com/goto?url=CAESnAEBxCJF1yKi
2 github.com | https://www.google.com/goto?url=CAESfQHEIkXXiMPs
3 python.plainenglish.io | https://www.google.com/goto?url=CAESjAEBxCJF17r9
4 Medium · Arpit Sharma | https://www.google.com/goto?url=CAESlwEBxCJF12Sg
5 LinkedIn · Nikita Sharma | https://www.google.com/goto?url=CAESoQEBxCJF1wKv
6 Stack Overflow | https://www.google.com/goto?url=CAESoAEBxCJF198m
7 Medium · Mayank Thakur | https://www.google.com/goto?url=CAESrQEBxCJF18j-
8 pypi.org | https://www.google.com/goto?url=CAEScgHEIkXXuN5J
9 pypi.org | https://www.google.com/goto?url=CAESbAHEIkXXHnPG
results: 9 | without domain: 5 | Google redirects: 9 | linksPending: False | credits: 1 | durationMs: 3776
Re-run on November 18, 2026 with the longer wait: 9 of 9 links were final URLs after 29 s. The page held nine organic results, not ten, as all six of our pages did, so do not assume a full page. The Python integration page and our Python guide to Google search results add pagination and CSV export.
Cost and limits after switching
After switching, you pay per search instead of per blocked IP address. BestSERP gives 3,000 free searches, valid for 30 days, then charges $0.50 per 1,000; failed searches are refunded, and purchased credits never expire.
| Workload | Searches a month | Cost at $0.50 per 1,000 |
|---|---|---|
| 100 queries a day, 10 results each | 3,000 | $1.50, or free in month one |
| 1,000 queries a day, 10 results each | 30,000 | $15 |
| 1,000 queries a day, 30 results each | 90,000 credits | $45 |
| A one-off run of 5,000 queries | 5,000 | $2.50, or $1 after the free searches |
One hour of a developer's time at the US median wage, $65.38 an hour in our build-versus-buy cost model, buys about 130,000 searches. If keeping googlesearch-python alive costs you an hour a month, the API is cheaper below roughly 130,000 searches a month.
The published limits replace Google's unpublished ones: 60 searches a minute per account (above that, a 429 with Retry-After that is never charged; see the error reference), desktop results by country and language, and no city-level targeting. Current prices are on the pricing page.
Common problems and fixes
| Problem | Cause | Fix |
|---|---|---|
HTTPError: 429 Client Error: Too Many Requests for url: https://www.google.com/sorry/... |
Google flagged your IP address | Stop, wait, then resume with sleep_interval=5 or more and fewer queries; or switch |
search() returns [] with no error |
Google answered without results: an unsupported-browser page since September 2025 | No setting in 1.3.0 fixes it; switch to an API |
TypeError: ... unexpected keyword argument 'num_results' |
The google package's googlesearch module is installed |
pip uninstall google, then reinstall googlesearch-python |
<generator object search ...> printed |
search() is a generator |
Wrap it in list() or loop over it |
requests.exceptions.ReadTimeout |
The default timeout is 5 seconds | Pass timeout=15 |
'' in the list of URLs |
1.3.0 returns a result for every block, even one without a link (seen in our simulation) | Keep items that start with http |
BestSERP answers 400 unknown_parameter |
Old names such as num_results sent in the body |
Send q, num, hl and gl |
BestSERP links start with google.com/goto |
The answer came before link resolution finished (linksPending: true) |
Poll until linksPending is false, for up to 2 minutes; use domain or source for the site |
BestSERP answers 429 rate_limited |
More than 60 searches in a minute | Wait for Retry-After; not charged |
How we checked this
- The library. We downloaded googlesearch-python 1.3.0 (wheel and source, checksums matched PyPI) and the 1.2.5 wheel, read the code, and read the GitHub issues about 429 errors, empty results and JavaScript, from 2021 to 2026.
- The simulation. We ran the unmodified 1.3.0 code (Python 3.12.10, requests 2.34.2, beautifulsoup4 4.15.0) with every HTTP request answered by a local stub and network connections disabled. The stub returned what the issues report: a redirect to
/sorry/with a 429, an unsupported-browser page, and pages of 10 results. - Not done. No request from googlesearch-python reached Google, so today's behavior rests on the issue tracker, not on our own test.
- BestSERP. On November 17, 2026 (gl=us, hl=en): three code runs and three research searches, 6 credits, plus one refused request with old argument names (a
400, not charged). The redirect anddomaincounts come from the four saved responses. On November 18, 2026 we re-ran the full code once with the 2-minute link wait (1 credit).
Next steps
googlesearch-python was a good shortcut while Google served plain HTML to simple clients, and that ended in September 2025. From here:
- New to SERP APIs: a practical guide to what a SERP API returns.
- Writing the replacement: the quickstart and the Python integration.
- Ready to test: create a free account for 3,000 free searches, then $0.50 per 1,000.