Lightweight Python SDK for sending count and value stats to Station.
Project description
Station Python
Python SDK for sending simple app stats to Station.
Install
pip install station-python
Usage
import station_python as station
station.set_api_key("your-api-key")
station.set_debug(True)
station.track_count("page_view")
station.track_count("signup", 3)
station.track_value("checkout_total", 24.95)
station.capture_count("background_job_started")
station.capture_value("api_latency_ms", 142)
Instead of calling set_api_key, you can set the STATION_API_KEY environment
variable before starting your app:
STATION_API_KEY=your-api-key python app.py
API
set_api_key(api_key)
Sets the Station API key used by subsequent events.
set_debug(enabled)
Enables or disables debug logging. Debug mode is disabled by default.
track_count(stat_name, value=1)
Sends a count event to Station. Use it for incrementing counters such as page views, clicks, signups, or other discrete events.
track_value(stat_name, value)
Sends a numeric value event to Station. Use it for measurements such as totals, durations, scores, or other numeric observations.
capture_count(stat_name, value=1)
Fire-and-forget version of track_count. It schedules the request and returns
immediately.
capture_value(stat_name, value)
Fire-and-forget version of track_value. It schedules the request and returns
immediately.
Network errors do not interrupt your application flow. Enable debug mode if you
want failed event submissions logged during development or diagnostics. The
client reuses keep-alive connections, applies a short request timeout, retries
one transient network/server failure, and backs off after 429 rate limit
responses.
Current Contract
The package posts to:
POST https://api.station.guide/v1/events/countPOST https://api.station.guide/v1/events/value
Request bodies use apiKey, statName, and value.
Development
uv sync --dev
uv run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file station_python-1.0.0.tar.gz.
File metadata
- Download URL: station_python-1.0.0.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dc78397388894eea97b139cbf48b406a7ebab58ea0d7dff2fe0464246662521
|
|
| MD5 |
1bf7296bf03b61fa98e83a8f3110fe70
|
|
| BLAKE2b-256 |
10f7a5c01a72fd258791a2fd240fb96d7ff754b12003d45dcd3744d4ea650959
|
File details
Details for the file station_python-1.0.0-py3-none-any.whl.
File metadata
- Download URL: station_python-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b9ddede8c217ccb166ef42b2cf54b3c7e603942fbb37deca437b1f2aa93b8e2
|
|
| MD5 |
86620c3b56f67f5d3954d1f41309b4f0
|
|
| BLAKE2b-256 |
4e8d6c52f04884a4d9e9f3e009b607c649a49252d6027e62716b96ab0b1bb706
|