Skip to main content

ai-traffic-insights (Python)

See how AI actually uses your site, from your own server logs. Python version of the npm package: same bot list, same checks, same report.

Analytics tools cannot see AI crawlers (they never run your analytics script), fake bots that borrow a trusted name, your own firewall blocking ChatGPT's search crawler, AI answers that link to pages that do not exist, or which products people ask AI assistants about. This tool reads your access logs and shows all of that. It runs on your machine, your logs are never uploaded, and the report contains no visitor IP addresses.

pip install ai-traffic-insights
ai-traffic-insights /var/log/nginx/access.log --site your-store.com

Several files, rotated and gzipped ones too, and your sitemap for coverage:

ai-traffic-insights access.log access.log.1 access.log.2.gz --site your-store.com --sitemap https://your-store.com/sitemap.xml

Reads nginx and Apache (combined and vhost_combined), Cloudflare Logpush, Vercel log drains, AWS CloudFront and IIS (W3C), and JSON access logs. No dependencies.

Use it from Python

from ai_traffic_insights import analyze_logs, format_text

result = analyze_logs(["access.log"], site="your-store.com", sitemap="https://your-store.com/sitemap.xml")
print(format_text(result))
for f in result["findings"]:
    print(f["severity"], f["title"])

The result is a plain dictionary with the same keys as the npm package's JSON output (bots, referrals, crawlRefer, askedAbout, coverage, findings, notes), so you can load it into pandas or a dashboard.

How bots are verified

A user agent can be faked. Each bot's requests are checked against the operator's official IP lists (OpenAI, Anthropic, Perplexity, Google, Microsoft, Apple, DuckDuckGo, Common Crawl), downloaded and cached for a day. --dns adds forward-confirmed reverse DNS for Googlebot, Bingbot, Applebot and CCBot. For a server without internet, run ai-traffic-insights --download-ranges ./ranges elsewhere and pass --ranges-dir ./ranges.

All options (--since, --until, --format, --top, --offline, --no-verify, --show-ips, --md, --json, --fail-on) and what every finding means are documented in the npm package README.

Same results as the JavaScript version

The bot list, AI referrer list and patterns are exported from the JavaScript source, and the test suite runs both versions on the same eight log fixtures (nginx, vhost, gzip, Cloudflare, Vercel, CloudFront, IIS, JSON) and checks that the full JSON result, the text report and the Markdown report are identical.

Sustainable Development Goals

This tool supports SDG target 8.3 (growth of micro, small and medium enterprises): AI assistants are becoming a route to market, and this gives a small store, from logs it already has, the view that large retailers buy from bot-management platforms. It also supports target 9.1 (reliable infrastructure): telling real crawlers from impostors lets a store block scrapers without cutting itself off from AI search, and cuts bandwidth and server energy wasted on fake traffic.

About

Built by Ahmad Zia, an AI and e-commerce consultant. MIT licensed.

Guide, help and author

Built by Ahmad Zia (Muhammad Ahmad Zia), an AI consultant for ecommerce since 2020 and green AI researcher at the University of Lahore. Research · Google Scholar · ORCID · LinkedIn · GitHub

Metadata

Release files for ai-traffic-insights 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 ai-traffic-insights 0.1.0
File Size Uploaded Provenance Actions
ai_traffic_insights-0.1.0.tar.gz 39.9 kB With provenance Details for ai_traffic_insights-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-traffic-insights 0.1.0
File Interpreter ABI Platform Actions
ai_traffic_insights-0.1.0-py3-none-any.whl Python 3 none any Details for ai_traffic_insights-0.1.0-py3-none-any.whl

Total release size: 74.7 kB

Release files / ai_traffic_insights-0.1.0.tar.gz

Download URL ai_traffic_insights-0.1.0.tar.gz
Size 39.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8df112ff352068182b7a9ae86cbdd92a8d5b549bf166df9ead2c4224fb29c79d
BLAKE2b-256 checksum
How to use checksums
fcadaeeeef260daaf068da5f87a0719b0ddb934fdab53e74d71d40da3cc44c36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

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

Download URL ai_traffic_insights-0.1.0-py3-none-any.whl
Size 34.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96bc591b0ad30c81dd312e3d685569b0ee836a3ec6f9540d03d187f9c6019288
BLAKE2b-256 checksum
How to use checksums
8a3ff6ab492a36a3db7a8ce68b91604816f5bbdaa981dd5a3dcf73101127f1cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Security for ai-traffic-insights 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ai_traffic_insights-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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