betting_combat.consumers.cito.rest
Async Cito UFC API client: the card listings and the live bout feed.
Every call is paced (RateLimiter, 10 a minute by default) and counted (CallBudget)
before it is sent, retries included. Cito answers slowly (5-50 s observed, one listing 65 s),
so the read timeout is long (90 s) and attempts are few (3): timeouts, 429 (Retry-After
honoured, and every caller held back as long) and 5xx are retried with backoff; any other
error is raised at once. The key (CITO_API_KEY) goes out in the x-api-key header and
nowhere else: never logged, never in an error, never in repr.
Receipts for every shape: tests/fixtures/cito (recorded 2026-10-25).
Classes
CitoError
Bases: RuntimeError
CitoRest
aclose
aclose() -> Noneevent_bouts
event_bouts(slug: str) -> list[CitoBout]Every bout of one card (cancelled and postponed ones hidden by Cito by default).
events_recent
events_recent() -> list[CitoEvent]The cards just held, newest first (the plan’s history window only).
events_upcoming
events_upcoming() -> list[CitoEvent]The cards to come (and, presumably, the one under way: unconfirmed).
from_settings
from_settings(settings: CitoSettings | None = None, **kwargs: Any) -> CitoRestA client on CITO_API_KEY; ValueError when the key is not set.
live
live(bout_id: str) -> LiveBoutOne bout now: the clock, the corners, the fight totals.
live_events
live_events() -> list[LiveEvent]The cards the live worker tracks: each one’s bouts (FightMetric ids) in order.
snapshots
snapshots(bout_id: str, limit: int = 20) -> SnapshotPageThe bout’s newest limit snapshots (newest first), each with every round’s
running line so far; limit=500 is the whole fight (188 for a five-rounder).
CitoSettings
Bases: BaseSettings
CITO_API_KEY (and CITO_BASE_URL) from the environment (production: the
location’s runtime secret; local: .env), as conf.settings reads every vendor’s.