Guide · Scraping practice
pytrends 429 Too Many Requests: why it happens and how to fix it
pytrends raises TooManyRequestsError: The request failed: Google returned a response with code 429 when Google Trends rate-limits your client. Google publishes no limit for these endpoints; the pytrends README says the limit is not publicly known and that 60 seconds of sleep between requests appears to be enough once you reach it. The fix is to slow down and back off on every 429 in your own code: pytrends' built-in retry option crashes on urllib3 2.x, and its proxy list only moves on after a success. pytrends itself is no longer maintained. Its GitHub repository was archived on 17 April 2025 and the last release on PyPI is 4.9.2 from April 2023; Google opened an official Trends API in alpha in July 2025.
Reviewed 2 Nov 2026
The short answer
- The error is pytrends wrapping HTTP 429:
TooManyRequestsError, a subclass ofResponseError, with the response attached as.response. TrendReq(retries=2, backoff_factor=0.5)fails withTypeError: Retry.__init__() got an unexpected keyword argument 'method_whitelist'on urllib3 2.x (reproduced with pytrends 4.9.2 and urllib3 2.8.0). Leave both at 0 and retry yourself.- With
proxies=[...], pytrends advances to the next proxy only after a successful call. After a 429 it keeps the same one. - With proxies set, pytrends fetches its cookie again before every call: one
build_payloadplusinterest_over_timemade five requests in our test, three of them for the cookie. - Retry with a minimum wait, random jitter and a new exit per attempt, then re-queue. We could not test against the live service; everything here ran against a local mock.
What the 429 means for Google Trends
429 Too Many Requests means you sent too many requests in a given time (RFC 6585). The server may say how long to wait in Retry-After, and may identify you by credentials or a cookie as well as by address. Google does not document the Trends endpoints pytrends calls; the project describes itself as a "pseudo API for Google Trends", and the README says the rate limit "is not publicly known".
pytrends' own code raises TooManyRequestsError for status 429 and ResponseError for anything else that is not a JSON response, so you can catch the 429 case separately and read exc.response.headers. General backoff technique is in handling 429 rate limits; this page covers what is specific to pytrends.
Is pytrends still maintained?
| Item | State on 2 November 2026 |
|---|---|
| GitHub repository (GeneralMills/pytrends) | Archived by the owner on 17 April 2025, read-only; last push 10 August 2024; 152 open issues |
| PyPI | Latest version 4.9.2, uploaded 13 April 2023 |
| urllib3 2.x | retries and backoff_factor crash (removed method_whitelist argument); calls with both at 0 work |
| Official alternative | Google Trends API, alpha since 24 July 2025, by application |
Archived means no fixes: if Google changes the endpoints or the response format, pytrends will not follow. Forks exist on PyPI; we have not evaluated them.
What we reproduced against a local mock
Setup, 2 November 2026: pytrends 4.9.2 on Python 3.12.6 with requests 2.34.2, urllib3 2.8.0 and pandas 3.1.0. A local HTTPS server stood in for the three Trends endpoints pytrends calls (the explore page that sets the NID cookie, /trends/api/explore and /trends/api/widgetdata/multiline), with a sliding-window limit of two API calls per five seconds that answers 429 with Retry-After: 2. Requests went through a local authenticated CONNECT proxy that logged the username of every tunnel.
| Test | Result |
|---|---|
TrendReq(retries=2, backoff_factor=0.5), then build_payload | TypeError: Retry.__init__() got an unexpected keyword argument 'method_whitelist' |
| Proxy list of three, four calls in a row | build_payload ok, index 0 → 1; interest_over_time ok, 1 → 2; build_payload 429, 2 → 2; build_payload 429, 2 → 2 |
| Tunnels per successful batch | Five: cookie at init, cookie + /api/explore, cookie + /api/widgetdata/multiline |
| Wrapper below, three keywords | All three returned data in 11.5 s; each of the last two hit two 429s first |
What we could not test: the live service. We sent no automated requests to Google Trends, so we cannot tell you its actual limit, whether its 429 carries Retry-After, or whether a new exit address helps there. In the mock the limit counted all traffic, so a new exit did not help; the wait did.
The fix: back off first, then use a new exit
- Keep pytrends' retries off (
retries=0, backoff_factor=0, the defaults) and catchTooManyRequestsErroryourself. - Wait at least a minimum. The README's observation of 60 seconds once you reach the limit is the only published figure; use it as the floor, honour
Retry-Afterif the response carries one, and add random jitter that grows with each attempt. - New exit per attempt. Build a fresh
TrendReqwith a new sticky session handle in the proxy username. Within one attempt the cookie, the token request and the data request then share one exit; the next attempt gets another. A rotating username without a handle draws a new exit per connection, which in pytrends means the cookie and the data call can come from different addresses. - Give up and re-queue after a few attempts, and pause between keyword batches even when nothing failed.
Rotation spreads a polite workload; it is not a way to send more than the service will take. See rotating vs sticky sessions and the sticky session entry for how the session handle works.
Send fewer requests
- Ask only for the timeframes and regions you use, and store what you fetched so a re-run of your analysis does not re-fetch it.
- Spread scheduled jobs over the day instead of starting them all at once.
- Do not pass a list of many proxies to pytrends to go faster: it refetches the cookie through each one before every call, which adds requests rather than removing them.
The official alternative: Google Trends API (alpha)
Google announced the Trends API on 24 July 2025. It covers a rolling window of 1,800 days (five years) up to two days before today, with daily, weekly, monthly and yearly aggregation and region and sub-region breakdowns by ISO 3166-2. Unlike the website, its values are not rescaled from 0 to 100 per request, so separate pulls can be compared. Access is by application to a limited alpha, and the page lists no quotas or pricing. If you qualify, it replaces an archived library calling undocumented endpoints.
Code
Worked example
import random, secrets, timefrom pytrends.request import TrendReqfrom pytrends.exceptions import TooManyRequestsErrordef proxy_for(session: str) -> str: # one sticky exit per attempt; a new handle draws a new exit return f"http://USERNAME_pool-arcfast_country-de_session-{session}_sesstime-10:PASSWORD@proxy.arcproxies.io:8000"MIN_WAIT, BASE, CAP, MAX_ATTEMPTS = 60.0, 15.0, 300.0, 6def retry_after(exc: TooManyRequestsError) -> float: value = exc.response.headers.get("Retry-After", "") return float(value) if value.isdigit() else 0.0def interest_over_time(keywords, timeframe="today 5-y", geo=""): for attempt in range(MAX_ATTEMPTS): session = secrets.token_hex(4) pt = TrendReq(hl="en-US", tz=0, timeout=(10, 30), proxies=[proxy_for(session)], retries=0, backoff_factor=0) # built-in retries break on urllib3 2.x try: pt.build_payload(keywords, timeframe=timeframe, geo=geo) return pt.interest_over_time() except TooManyRequestsError as exc: jitter = random.uniform(0, min(CAP, BASE * 2 ** attempt)) wait = max(retry_after(exc), MIN_WAIT) + jitter print(f"429 on attempt {attempt + 1}; new exit after {wait:.1f}s") time.sleep(wait) raise RuntimeError("still rate-limited; re-queue this batch for later")t0 = time.monotonic()for kw in (["proxy"], ["vpn"], ["scraping"]): df = interest_over_time(kw) print(f"{time.monotonic() - t0:5.1f}s {kw[0]!r}: {len(df)} rows, last value {int(df.iloc[-1, 0])}") 0.1s 'proxy': 2 rows, last value 57429 on attempt 1; new exit after 2.3s429 on attempt 2; new exit after 3.3s 5.7s 'vpn': 2 rows, last value 57429 on attempt 1; new exit after 2.8s429 on attempt 2; new exit after 2.9s 11.5s 'scraping': 2 rows, last value 57FAQ
Questions
Something not covered? Write to contact@arcproxies.io.
Why does pytrends return 429 Too Many Requests?
Google Trends is rate-limiting your client: too many requests in a period. Google publishes no limit for the endpoints pytrends uses, and pytrends turns the 429 into TooManyRequestsError. Slow down and back off; the README reports that 60 seconds between requests appears to be enough once you reach the limit.
How long should I wait after a pytrends 429?
At least 60 seconds, the only figure published (in the pytrends README), or longer if the response carries Retry-After. Add random jitter that grows with each attempt and re-queue the batch after a handful of attempts.
Why does TrendReq with retries or backoff_factor raise a method_whitelist TypeError?
pytrends 4.9.2 passes method_whitelist to urllib3's Retry. urllib3 deprecated that argument in 1.26 and removed it in 2.0, so with urllib3 2.x any retries or backoff_factor above 0 raises TypeError. Keep both at 0 and retry in your own code.
Is pytrends still maintained?
No. The GitHub repository was archived on 17 April 2025 and is read-only, and the latest PyPI release is 4.9.2 from April 2023 (checked on 2 November 2026). Google's official Trends API is in alpha.
Do proxies fix pytrends 429 errors?
Not on their own. pytrends only moves to the next proxy after a successful call, and a new address does not change how fast your job sends requests. Back off first; use a new exit per retry attempt to spread a polite workload.
Is there an official Google Trends API?
Yes, in alpha since July 2025. It offers five years of data with daily to yearly aggregation and region breakdowns, with values that stay comparable across requests. Access is by application and limited.
Sources & review
Last reviewed by the ARC Proxies team. Prices are read from the live catalog at build time.
- [1]GitHub: GeneralMills/pytrends (archived 17 April 2025)
- [2]PyPI: pytrends 4.9.2
- [3]urllib3: Changelog: 1.26.0 deprecation and 2.0.0 removal of Retry(method_whitelist)
- [4]Google Search Central Blog: Introducing the Google Trends API (alpha) (24 July 2025)
- [5]Google for Developers: Get early access to the Google Trends API alpha
- [6]IETF: RFC 6585: Additional HTTP Status Codes (429 Too Many Requests)
Next
Where to go from here
Guides