TopStats SDK

Python analytics SDK

A dependency-free client for Python 3.10+. capture() enqueues and returns immediately; a background thread batches and sends. FastAPI, Starlette, Flask and Django have ready-made middleware in the topstats-web package built on this SDK.

Install

pip install git+https://github.com/top-stats/analytics-python-sdk  # PyPI soon

Capture your first event

from topstats_analytics import TopStats

client = TopStats(os.environ["TOPSTATS_API_KEY"])

client.capture("job_finished", {"rows": 1200}, actor="worker-7")
client.shutdown()  # flushes the tail

Behaviour you can rely on

Every other language

Your first event is minutes away.

Twelve language SDKs, middleware for nine web frameworks, plugins for seven games, and raw HTTP - all working today. Free plan, 2M events a month, no card.