status302 — Python SDK
Official Python client for the Status302 API: real-time ticket market data (catalog, metrics, sales, seat maps) over REST, a realtime WebSocket stream and signed webhooks.
- Typed methods for every public operation (
TypedDictmodels generated from the public OpenAPI spec) - Blocking
Status302and asyncioAsyncStatus302clients on httpx - Automatic retries on
429and5xx(idempotent requests) honouringRetry-After - Pagination helpers (cursors and alert
nextBeforeids) and typed errors (PlanRequiredError,RateLimitError, …) carrying the response'srequest_id(also appended to the message as(request <id>); quote it to support) - Conditional requests:
if_none_matchwith a typedNotModifiedresult, response ETags, and an opt-in ETag cache - Stream client: bearer or ticket auth, reconnects with backoff,
sinceresume per topic, resync notices, seq deduplication - Webhook signature verification
The package version equals the version of the public API spec it was generated from.
Install
pip install status302 # or: uv add status302
Python ≥ 3.11.
Quickstart
import os
from status302 import Status302
with Status302(api_key=os.environ["STATUS302_API_KEY"]) as status302:
page = status302.list_events(country="US", limit=5)
for event in page["items"]:
print(event["id"], event["name"], event["startsAt"])
metrics = status302.get_event_metrics(page["items"][0]["id"])
for row in metrics["items"]:
print(row["scope"], row["floor"], row["currency"]) # money is integer minor units
Create an API key in the app under Settings → Developers. Keys look like tx_live_<keyId>_<secret> and are sent as Authorization: Bearer ….
Pagination
for event in status302.paginate(status302.list_events, country="US", limit=200):
...
pages(...) yields whole pages instead. Both follow nextCursor until it is null, or nextBefore (as before) for list_alert_rules and list_alert_events.
Conditional requests
from status302 import MemoryETagCache, NotModified, Status302
first = status302.with_response.get_event_metrics(4102) # APIResponse with .data, .etag, .status, .rate_limit
nxt = status302.get_event_metrics(4102, if_none_match=first.etag) # types.EventMetricsList | NotModified
if isinstance(nxt, NotModified):
print("unchanged since", nxt.etag)
cached = Status302(api_key=os.environ["STATUS302_API_KEY"], etag_cache=MemoryETagCache())
Operations that accept If-None-Match take if_none_match; a 304 returns NotModified instead of raising, and the return type includes it only when the argument is passed. with_response has every operation returning the whole APIResponse. With etag_cache the client revalidates every GET by itself and returns the stored body on 304; MemoryETagCache(max_entries=1000) is thread-safe and LRU, and any object with get/set (the ETagCache protocol) works.
Errors and rate limits
from status302 import PlanRequiredError, RateLimitError
try:
status302.list_movers(window="24h")
except PlanRequiredError as e:
print("needs plan", e.required_plan)
except RateLimitError as e:
print("retry in", e.retry_after, "s; quota:", e.rate_limit)
429 responses are retried after Retry-After (up to max_retry_after, default 60 s); 5xx and connection errors are retried for idempotent methods with exponential backoff (max_retries, default 3). status302.request(...) returns the body together with status, headers, ETag and the parsed RateLimit state.
Realtime stream
import asyncio, os
from status302 import AsyncStatus302, DataMessage, ResyncMessage
async def main() -> None:
async with AsyncStatus302(api_key=os.environ["STATUS302_API_KEY"]) as status302:
async with status302.stream() as stream:
stream.subscribe("sales", filter={"country": ["US"]})
async for message in stream:
if isinstance(message, DataMessage):
print(message.seq, message.data)
elif isinstance(message, ResyncMessage):
snapshot = await stream.fetch_snapshot(message)
asyncio.run(main())
The key needs the stream scope to connect, and each topic the scope of its REST equivalent (event.{id}.kpis → market:read, sales/event.{id}.sales → sales:read, event.{id}.primary → maps:read or market:read, onsales → catalog:read, alerts → alerts:write); without it the subscription fails with a forbidden_topic SubscriptionError. Server-side code authenticates with the key on the upgrade request (auth="bearer", default with a key); pass auth="ticket" and get_ticket= to connect with single-use tickets instead (same scopes as the key).
Binary encoding (MessagePack)
stream(encoding="msgpack") asks the server for binary MessagePack frames (encoding=msgpack on the URL) instead of JSON text. Messages and data payloads decode to the same values as with JSON, so iteration doesn't change; the client's own messages stay JSON. Default: "json".
Webhooks
from status302 import verify_webhook, WebhookVerificationError
event = verify_webhook(raw_body, headers["Status302-Signature"], os.environ["STATUS302_WEBHOOK_SECRET"])
Versioning
Releases share the version of the API spec they were generated from (status302.__version__); /v1 changes are additive only, so new fields, operations and enum values arrive in minor releases. See the changelog.
License
MIT
Metadata
Release files for status302 1.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| status302-1.7.0.tar.gz | 92.9 kB | Without provenance | Details for status302-1.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| status302-1.7.0-py3-none-any.whl | Python 3 | none | any | Details for status302-1.7.0-py3-none-any.whl |
Total release size: 189.2 kB
Release files / status302-1.7.0.tar.gz
| Download URL | status302-1.7.0.tar.gz |
|---|---|
| Size | 92.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17b0dc013f4fd2f6e0f63f8c09afb55bf986cae0ed2757390b3e064e2601dae0
|
|
BLAKE2b-256 checksum How to use checksums |
25fa948116a81db9181579fa4dd03e3367b9f966334d65ac707f1a1a4736636d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / status302-1.7.0-py3-none-any.whl
| Download URL | status302-1.7.0-py3-none-any.whl |
|---|---|
| Size | 96.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89406caa0f881707be8fb4e18db112e29069516bfa2b5ddc589f21c302edf5b1
|
|
BLAKE2b-256 checksum How to use checksums |
e6ef680bd96156ead766fa7847fd62d6eeba6910e9fb7377d64d4aef42e3c119
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for status302 1.7.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.