A Python Trends API client is a Bearer-authenticated POST to https://api.trendsapi.ai/api, then a second json.loads on the body string. On 2026-08-08, Google Search interest for python sat at 56.0 on 2026-08-01 with 7D growth of -9.68%, 30D of -24.32%, 3M of -24.32%, and 12M flat at 0.0%. The same day pull on the python source showed pandas at score 100.0 with 192,032,793 weekly downloads on 2026-07-27 and 12M volume growth of 111.7%. That pairing is the point of the integration: search interest and package volume share one JSON contract.
Minimal requests client
Install requests, set TRENDSAPI_API_KEY, and keep the double parse in one helper. Free tier allows 100 successful requests per month. Only HTTP 200 responses count against quota. Starter is 5,000, Pro is 25,000, Business is 100,000.
import json
import os
import requests
API_URL = "https://api.trendsapi.ai/api"
API_KEY = os.environ["TRENDSAPI_API_KEY"]
def trends_api(payload: dict) -> dict:
r = requests.post(
API_URL,
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json=payload,
timeout=60,
)
r.raise_for_status()
envelope = r.json()
# body is a JSON string; parse it a second time
return json.loads(envelope["body"])
growth = trends_api({
"mode": "get_growth",
"source": "google search",
"keyword": "python",
"percent_growth": ["7D", "30D", "3M", "12M"],
})
print(growth["results"][0]["growth"])
The first mistake most clients make is reading envelope["body"]["results"]. That fails because body is still a string.
Google Search growth for language and framework terms
Pulled on 2026-08-08 with source set to google search. Recent points land on 2026-08-01.
| Keyword | Period | Recent value | Baseline date | Baseline value | Growth |
|---|---|---|---|---|---|
| python | 7D | 56.0 | 2026-07-25 | 62.0 | -9.68% |
| python | 30D | 56.0 | 2026-07-04 | 74.0 | -24.32% |
| python | 3M | 56.0 | 2026-05-02 | 74.0 | -24.32% |
| python | 12M | 56.0 | 2025-08-02 | 56.0 | 0.0% |
| fastapi | 7D | 26.0 | 2026-07-25 | 35.0 | -25.71% |
| fastapi | 30D | 26.0 | 2026-07-04 | 91.0 | -71.43% |
| fastapi | 3M | 26.0 | 2026-05-02 | 50.0 | -48.0% |
| fastapi | 12M | 26.0 | 2025-08-02 | 25.0 | 4.0% |
fastapi shows a sharp 30D drop from 91.0 to 26.0 while 12M remains slightly up at 4.0%. Short windows and long windows answer different questions; keep both in the payload.
For source docs and field notes, see Google Search trends. For a scrape-based Google client comparison, see the pytrends alternative.
PyPI volumes on the python source
Keywords on source: "python" must be exact PyPI project names. Pulled on 2026-08-08; recent rows use 2026-07-27.
| Package | Period | Score | Recent volume | Baseline volume | Score growth | Volume growth |
|---|---|---|---|---|---|---|
| pandas | 7D | 100.0 | 192,032,793 | 173,720,636 | 11.48% | 10.54% |
| pandas | 30D | 100.0 | 192,032,793 | 175,566,055 | 10.13% | 9.38% |
| pandas | 3M | 100.0 | 192,032,793 | 160,423,447 | 21.51% | 19.7% |
| pandas | 12M | 100.0 | 192,032,793 | 90,709,928 | 131.48% | 111.7% |
| requests | 7D | 100.0 | 423,571,217 | 395,876,099 | 7.53% | 7.0% |
| requests | 30D | 100.0 | 423,571,217 | 388,260,772 | 9.77% | 9.09% |
| requests | 3M | 100.0 | 423,571,217 | 337,351,216 | 27.55% | 25.56% |
| requests | 12M | 100.0 | 423,571,217 | 186,701,901 | 146.31% | 126.87% |
| httpx | 7D | 100.0 | 200,438,174 | 179,881,307 | 11.48% | 11.43% |
| httpx | 30D | 100.0 | 200,438,174 | 166,606,471 | 20.48% | 20.31% |
| httpx | 3M | 100.0 | 200,438,174 | 152,537,494 | 31.58% | 31.4% |
| httpx | 12M | 100.0 | 200,438,174 | 59,034,659 | 243.64% | 239.53% |
| numpy | 7D | 100.0 | 282,266,140 | 252,824,705 | 12.49% | 11.64% |
| numpy | 30D | 100.0 | 282,266,140 | 255,880,634 | 10.99% | 10.31% |
| numpy | 3M | 100.0 | 282,266,140 | 218,627,042 | 31.58% | 29.11% |
| numpy | 12M | 100.0 | 282,266,140 | 120,597,025 | 155.75% | 134.06% |
requests leads absolute volume at 423,571,217 weekly downloads. httpx posts the largest 12M score growth at 243.64%. pandas time series history in this pull starts at 2021-08-02 with value 2.9 and volume 18,992,472, then reaches 100.0 and 192,032,793 on 2026-07-27 across 261 points.
series = trends_api({
"mode": "get_time_series",
"source": "python",
"keyword": "pandas",
})
latest = series[-1]
print(latest["date"], latest["value"], latest["volume"])
Wiring growth into a cron job
Keep one helper, one key, and a small loop over keywords. Write CSV or push rows to a warehouse. Retry only on transport errors; a 200 with an empty result list is a finding, not a network fault.
KEYWORDS = [
("google search", "python"),
("python", "pandas"),
("python", "httpx"),
]
rows = []
for source, keyword in KEYWORDS:
payload = {
"mode": "get_growth",
"source": source,
"keyword": keyword,
"percent_growth": ["30D", "12M"],
}
data = trends_api(payload)
for item in data["results"]:
rows.append({
"source": source,
"keyword": keyword,
"period": item.get("period"),
"growth": item.get("growth"),
"recent_value": item.get("recent_value"),
"recent_volume": item.get("recent_volume"),
})
For a product-research walkthrough that uses the same client against TikTok, Amazon, and Google Shopping, see collagen peptides multisource signals in Python. For Google-only unofficial client tradeoffs, use the pytrends alternative page.
Response envelope checklist
POST https://api.trendsapi.ai/apiwithAuthorization: Bearer <api_key>.- Modes are
get_time_series,get_growth, andget_top_trendsonly. - Parse
bodytwice before readingresultsor dated points. - Google Search uses descriptive keywords; the
pythonsource requires exact PyPI names. - Quota counts successful 200 responses: free 100/month, then 5,000 / 25,000 / 100,000 on paid tiers.
That is the full Python integration surface. No SDK is required. A 30-line requests helper covers growth, series, and board pulls for pipelines that already run on cron.