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.1

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.1
File Size Uploaded
pytrends_ng-0.1.1.tar.gz 6.2 kB Details

Built distribution (wheel)

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

Total release size: 12.4 kB

Release files / pytrends_ng-0.1.1.tar.gz

Download URL pytrends_ng-0.1.1.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
039a2f3dcc7cf30bdd669e75ef89871ecfabb693f01c0dd5fec33cf40f85165f
BLAKE2b-256 checksum
How to use checksums
f61cf44d3a74fbfdf277fc049a410eef45142c5e92243073f3bb7a45ed64e547
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.1-py3-none-any.whl

Download URL pytrends_ng-0.1.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9b99e77315dabae700d168cd3344514cc1fb381cd7bcc109928afad02d56726
BLAKE2b-256 checksum
How to use checksums
c3ce21aa3b9c9ce91b2ae564ed57ba274236e174b0b8a2d69eeb2bd9601ce654
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

This release

0.1.1 This release

2 release files

0.1.0

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