Skip to main content

Website traffic-rank API

Top website / web traffic leaderboard via the Trends API live feeds. Competitive intel as JSON.

License: MIT PyPI Python

Key: trendsapi.ai/#get-key. HTTP contract: trendsapi-ai/trendsapi.

JS: web-traffic-api.

Authentication

pip install web-traffic-api
export TRENDSAPI_KEY=your_key

Python 3.9+. The wrapper re-exports TrendsAPI, AsyncTrendsAPI, and TrendsAPIError from the official client.

from web_traffic_api import TrendsAPI

client = TrendsAPI()                    # TRENDSAPI_KEY
# client = TrendsAPI(api_key="YOUR_KEY")

get_top_websites() presets type: "Top Websites". Official full client (every source, no preset): trendsapi.

Methods

Method REST mode Returns
get_top_websites(limit=, offset=, category=) get_top_trends GetTopTrendsResponse
get_top_trends(type=, ...) get_top_trends GetTopTrendsResponse

source is lowercase (google search). type is exact (Top Websites). Mixing them is a 400.

from web_traffic_api import TrendsAPI

client = TrendsAPI()                    # TRENDSAPI_KEY
# client = TrendsAPI(api_key="YOUR_KEY")

sites = client.get_top_websites(limit=25)
print(sites.data[0])                    # [1, "google.com"]
sites = client.get_top_websites(limit=25)
Field Meaning
as_of_ts Snapshot time
type Feed name
limit, offset, count Pagination
data [rank, label] rows

Python: hot.data. JS: hot.data. Optional offset= and category= (Amazon Best Sellers by Category, Top Websites only).

Async

import asyncio
from web_traffic_api import AsyncTrendsAPI

async def main():
    client = AsyncTrendsAPI()
    return await client.get_top_websites(limit=25)

asyncio.run(main())

Each 200 is one billed request.

Call (curl)

Field Value
Endpoint POST https://api.trendsapi.ai/api
Auth Authorization: Bearer $TRENDSAPI_KEY
Mode get_top_trends
type Top Websites (exact capitalization)
Optional category, limit, offset
curl -sS -X POST https://api.trendsapi.ai/api \
  -H "Authorization: Bearer $TRENDSAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode":"get_top_trends","type":"Top Websites","limit":25}'

Source notes

  • There is no source: web traffic (that string is 400).
  • Parsed data is [rank, hostname] pairs.
  • This is third-party rank estimation, not Google Analytics.

Errors

HTTP Client
200 Parsed payload. Python dataclasses / JS typed objects
400 Raises. Fix source or type spelling
401 Raises. Check TRENDSAPI_KEY
404 Raises. No series for that keyword. Do not retry
429 Raises. Quota
5xx Client retries, then raises

The HTTP body field is a JSON string. SDKs decode it. Raw curl must parse body a second time.

Site: https://trendsapi.ai/trends/web-traffic. GitHub: trendsapi-ai/web-traffic-api.

License

MIT. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

web_traffic_api-1.0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

web_traffic_api-1.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file web_traffic_api-1.0.1.tar.gz.

File metadata

  • Download URL: web_traffic_api-1.0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for web_traffic_api-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5b47e6de1f44b37bedc41b97e869b1d411d230ca1a8b67d23d0f88b6c19b90e5
MD5 f9a5b8db9ca3ff5ffeaca4051f35648e
BLAKE2b-256 ea98475eb151972ddafccbf0d74f6f5f50acd78822cc03692a79f8f4a8e14fd0

See more details on using hashes here.

File details

Details for the file web_traffic_api-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for web_traffic_api-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b821c30a2a610ff7931aa38e329c2d0f1988531ff950f443b011a6467104885
MD5 9689bc55e51efc0e3c5bf32c9d985022
BLAKE2b-256 9a70bf23dadc611b2846d8587cfe27b9da6d5d00de449c4933179b97ce7eb23f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page