pytrends-reliable — maintained pytrends alternative (Google Trends API for Python)
pytrends is archived (last release April 2023) and many users now hit TooManyRequestsError: The request failed: Google returned a response with code 429, or find that trending_searches() no longer works.
pytrends-reliable keeps the exact pytrends interface — change one import and your code runs again:
# before
from pytrends.request import TrendReq
# after
from pytrends_reliable.request import TrendReq
pytrends = TrendReq(hl='en-US', tz=360)
pytrends.build_payload(['coffee', 'tea'], timeframe='today 3-m', geo='US')
pytrends.interest_over_time() # DataFrame: date index, one column per keyword, isPartial
pytrends.interest_by_region(resolution='REGION', inc_geo_code=True)
pytrends.related_queries() # {'coffee': {'top': df, 'rising': df}, 'tea': {...}}
pytrends.related_topics()
pytrends.trending_searches(pn='united_kingdom') # works again
pytrends.suggestions('tesla')
pip install pytrends-reliable
What's different from pytrends
| pytrends 4.9.2 | pytrends-reliable | |
|---|---|---|
| Maintained | ❌ archived | ✅ |
| HTTP 429 | raises immediately | retries with a fresh cookie and exponential backoff |
trending_searches, today_searches, realtime_trending_searches |
broken (Google removed the endpoints) | ✅ use Google's current "Trending now" endpoint |
trending_now(geo, hours) |
— | ✅ search volume, % increase, start time, related terms, categories |
| When Google keeps blocking your IP | stuck | optional reliable backend (below) |
| Same method names, parameters and DataFrames | ✅ | ✅ |
Reliable backend
Free direct requests are fine for occasional use, but Google rate-limits IP addresses quickly — especially servers, notebooks in the cloud and scheduled jobs. When that happens you can route the same calls through a managed Google Trends scraper that rotates IP addresses:
pytrends = TrendReq(backend='apify', apify_token='YOUR_APIFY_TOKEN')
# or: export APIFY_TOKEN=... and keep TrendReq() — it switches automatically after repeated 429s
- Same methods, same DataFrames.
- Uses the Google Trends Scraper on Apify: about $1.50 per 1,000 searches; Apify's free plan includes monthly credits.
- Each
build_payload+ data calls = one search (the data is fetched once and cached). - Slower per call (a cloud run takes ~20–40 s) but it does not get blocked.
Disclosure: I built both this library and the Apify scraper. The direct backend is free and needs no account; the reliable backend is optional.
Supported methods
| Method | Direct backend | Reliable backend |
|---|---|---|
build_payload(kw_list, cat, timeframe, geo, gprop) |
✅ | ✅ (one timeframe for all keywords) |
interest_over_time() |
✅ | ✅ |
interest_by_region(resolution, inc_low_vol, inc_geo_code) |
✅ COUNTRY / REGION / CITY / DMA | ✅ |
related_queries(), related_topics() |
✅ | ✅ |
trending_now(geo, hours) |
✅ | ✅ |
trending_searches(pn), today_searches(pn), realtime_trending_searches(pn) |
✅ | ✅ |
suggestions(keyword), categories() |
✅ | direct |
multirange_interest_over_time() |
✅ | ❌ |
top_charts(date) |
as pytrends (Google may have retired it) | ❌ |
Timeframes are Google's: 'today 5-y', 'today 12-m', 'today 3-m', 'today 1-m', 'now 7-d', 'now 1-d', 'now 4-H', 'now 1-H', 'all', '2024-01-01 2024-06-30', '2024-01-01T10 2024-01-03T10'.
Tips against 429 with the direct backend
- Reuse one
TrendReqobject; avoid many parallel scripts on the same IP. - Wait a few seconds between
build_payloadcalls. TrendReq(max_429_retries=6)retries longer;proxies=['https://...']rotates your own proxies (same as pytrends).
License
Apache 2.0. Keeps the public interface of pytrends (Apache 2.0, © General Mills). Independent project, not affiliated with Google or the pytrends maintainers.
Metadata
Release files for pytrends-reliable 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pytrends_reliable-0.1.0.tar.gz | 14.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytrends_reliable-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.8 kB
Release files / pytrends_reliable-0.1.0.tar.gz
| Download URL | pytrends_reliable-0.1.0.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86dc8b858607c4d43f140c4d367bd716685ecc0961bd784d1493620843fc083c
|
|
BLAKE2b-256 checksum How to use checksums |
e49e84e35f128bbc1c9e31362e1c3659b038bb07d14dd3d023df5faed785ab51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / pytrends_reliable-0.1.0-py3-none-any.whl
| Download URL | pytrends_reliable-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f473118a04ea4aae27e7a21acdac020d52562737b15de087430e3ced442f4740
|
|
BLAKE2b-256 checksum How to use checksums |
6b7e8dae5099b468247e0c68b6c181a1932d5275940b7b7d1a0e229391386d13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for pytrends-reliable 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.