Google Trends guides · Updated 2026-10-03
pytrends 429 error: why it happens and how to fix it
TooManyRequestsError: The request failed: Google returned a response with code 429 means Google Trends decided your traffic looks automated and is slowing you down.
Why it happens
- Per-IP and per-cookie limits. Google does not publish the limit. It is applied to your IP address and to the session cookie that pytrends gets on its first request.
- One call is several requests.
build_payload()fetches widget tokens, theninterest_over_time(),interest_by_region()andrelated_queries()each make their own request. Ten keywords with three methods is already dozens of requests. - Cloud IPs start with a bad reputation. The same script often works on a laptop and fails on AWS, GCP, Colab or GitHub Actions, because those ranges are heavily used by other scrapers.
- No retries by default.
TrendReq()hasretriesandbackoff_factorparameters, but they are off unless you set them.
Fixes that help, in order
- Batch keywords. Put up to 5 terms in one
kw_listinstead of one call per keyword. You also get them on the same 0-100 scale. - Ask only for what you need. Skip
related_queries()orinterest_by_region()if you do not use them. - Back off properly. Catch the 429 and wait 5, 10, 20, 40 seconds with a little random jitter, then retry. The pytrends README notes that about 60 seconds between requests works once you are already limited.
- Cache. Weekly data for the last 12 months does not change within a day. Save results and re-use them.
- Rotate sessions. After a 429, a new session (new cookie) on a new IP usually works immediately. pytrends accepts a
proxieslist, but only HTTPS proxies, and free proxy lists are mostly dead or already blocked.
Backoff example for pytrends
import random, time
from pytrends.request import TrendReq
from pytrends.exceptions import TooManyRequestsError
def with_backoff(fn, tries=6):
for i in range(tries):
try:
return fn()
except TooManyRequestsError:
time.sleep(5 * 2 ** i + random.uniform(0, 3))
raise RuntimeError("still rate-limited")
pt = TrendReq(hl="en-US", tz=0)
pt.build_payload(["coffee", "tea", "matcha"], timeframe="today 12-m", geo="US")
df = with_backoff(pt.interest_over_time)
The bigger problem: pytrends is archived
The GeneralMills/pytrends repository is archived. Its last code push was in August 2024 and the last release on PyPI (4.9.2) is from April 2023. When Google changed endpoints in February 2025, users reported 404 errors in issue #638, and trending_searches() returns 404 because the old daily trends page no longer exists. Backoff does not fix a dead endpoint.
Options compared
| Option | 429 handling | Trending now | Cost |
|---|---|---|---|
| pytrends + backoff | Your IP only, slow | Broken (404) | Free |
| Your own proxies + rotation | Good if you maintain it | You build it | Proxy bill + your time |
| Official Google Trends API (alpha) | Not an issue | Not offered | Invite-only since July 2025 |
| Hosted scraper (for example our Actor) | Handled for you | Yes | Pay per result |
Skip the 429s: hosted Google Trends
We built the Google Trends Scraper on Apify for this problem. Each request gets a fresh session and IP, retries up to 10 times with exponential backoff, and failed comparisons do not fail the whole run. It returns interest over time, interest by region, related queries and Trending now. It costs about $1.50 per 1,000 results, less on paid Apify plans.
From Python, our free MIT client ctriolab/google-trends-python wraps it with pytrends-style helpers:
import gtrends # export APIFY_TOKEN=...
df = gtrends.interest_over_time_df(["coffee", "tea", "matcha"], geo="US", timeframe="today 12-m")
Open Google Trends Scraper Python client on GitHub
Disclosure: we make and sell the Google Trends Scraper. The backoff advice above works without it.
FAQ
Why does pytrends return 429 after only a few requests?
Google Trends rate-limits automated traffic per IP address and per session cookie. Every pytrends call is several HTTP requests (a token request plus one per widget), so a loop over keywords reaches the limit quickly, especially from cloud servers whose IP ranges are already flagged.
How long should I wait after a 429?
The pytrends README reports that about 60 seconds of sleep between requests works once you hit the limit. Exponential backoff (for example 5, 10, 20, 40 seconds with random jitter) recovers faster than a fixed sleep.
Is pytrends still maintained?
No. The repository is archived (read-only); its last code push was in August 2024 and the last PyPI release, 4.9.2, is from April 2023. It still installs, but nobody fixes it when Google changes an endpoint.
Is there an official Google Trends API?
Google announced an official Google Trends API in July 2025 as an alpha for a limited number of approved testers. It covers consistently scaled interest data, not related queries or Trending now, and there is no open sign-up.
Related: Google Trends API in Python: options in 2026 · Google Trending now data