Skip to main content

pytrends-ng: pytrends without the 429 errors

pytrends was archived in April 2025 and its last release is from 2023. Google answers it with 429 Too Many Requests most of the time. pytrends-ng keeps the same calls, so your code works again after changing one import:

# from pytrends.request import TrendReq
from pytrends_ng import TrendReq

pytrends = TrendReq()  # reads APIFY_TOKEN from the environment
pytrends.build_payload(["chatgpt", "claude", "gemini"], timeframe="today 3-m", geo="US")

pytrends.interest_over_time()        # DataFrame: date index, one column per keyword, isPartial
pytrends.interest_by_region()        # DataFrame: one row per region
pytrends.related_queries()           # {keyword: {"top": DataFrame, "rising": DataFrame}}
pytrends.trending_searches(pn="united_states")

How it works

The requests run on a hosted Google Trends actor on Apify, which rotates IPs and retries rate limits for you. No proxies to buy, no sleep loops.

  1. Create a free Apify account. It includes $5 of usage every month.
  2. Copy your API token from Settings > Integrations.
  3. pip install pytrends-ng and export APIFY_TOKEN=...

Pricing is $2 per 1,000 results, where one result is one keyword in one country with its full timeline, regions and related queries. A 5-keyword payload costs $0.01, so the free credit covers about 2,500 keywords a month.

Better than the original

  • More than 5 keywords. build_payload takes any number of keywords and puts them all on one shared 0-100 scale. Google's own limit is 5.
  • Small keywords stay accurate. Keywords far smaller than the biggest one keep decimal values instead of rounding to 0.
  • One request per payload. interest_over_time, interest_by_region and related_queries all read from the same run.

Supported calls

pytrends call Status
build_payload(kw_list, cat, timeframe, geo, gprop) Yes
interest_over_time() Yes
interest_by_region(resolution, inc_low_vol, inc_geo_code) COUNTRY, REGION, DMA (not CITY)
related_queries() Yes. value is numeric; formattedValue keeps Google's text such as Breakout
trending_searches(pn), today_searches(pn), realtime_trending_searches(pn) Yes
related_topics(), suggestions() Not yet

Constructor arguments such as hl, tz, proxies and retries are accepted and ignored, so existing code does not break.

License

MIT. Not affiliated with Google or the original pytrends authors.

Metadata

Release files for pytrends-ng 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytrends-ng 0.1.0
File Size Uploaded
pytrends_ng-0.1.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytrends-ng 0.1.0
File Interpreter ABI Platform
pytrends_ng-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / pytrends_ng-0.1.0.tar.gz

Download URL pytrends_ng-0.1.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
050971106cd3704798cade9171c037f4a589dea6b601116e2a1b34ed376c022f
BLAKE2b-256 checksum
How to use checksums
ba21dad9bed5c60389e285437fc3162e1c7c4c115e5395803de028e0d30801e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / pytrends_ng-0.1.0-py3-none-any.whl

Download URL pytrends_ng-0.1.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05a75cfb02bff4f6bcf8c3ad16062a2ce8fefd87e658e0245278e4887dfb22b9
BLAKE2b-256 checksum
How to use checksums
fee0dfe3f3500920e9aca745afe6f7f5f93805cdd93c8742080ec92dd609169d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page