Client¶
Synchronous top-level client for the ThemeParks.wiki API.
Wraps an httpx.Client with retries and an in-memory LRU cache that is
on by default (per-endpoint TTLs live in :mod:themeparks._cache). Exposes
both a raw surface (tp.raw) of 1:1 OpenAPI operations and an ergonomic
surface (tp.destinations, tp.entity(id)) that returns pydantic
models. Use as a context manager so the underlying HTTP client is closed.
Example
from themeparks import ThemeParks with ThemeParks() as tp: ... dests = tp.destinations.list()
rate_limit
property
¶
What the server last said about your two budgets.
rate_limit.rest is the per-minute REST meter; rate_limit.history
is the separate hourly history budget. Every field can be None,
because every field can be legitimately absent: an unmetered plan
advertises nothing, and neither does a publicly cacheable response,
since the figures belong to whoever populated the cache.
None therefore means "the server did not say", never "nothing left".
with ThemeParks(api_key=KEY) as tp:
tp.entity(park).live()
print(tp.rate_limit.rest.remaining) # e.g. 299
Asynchronous mirror of :class:ThemeParks.
Backed by httpx.AsyncClient with the same retry, caching, and dual raw
+ ergonomic surfaces as the sync client. Enter with async with so the
underlying client is closed cleanly. All ergonomic methods that hit the
network are coroutines.
Example
from themeparks import AsyncThemeParks async with AsyncThemeParks() as tp: ... dests = await tp.destinations.list()
rate_limit
property
¶
What the server last said about your two budgets.
rate_limit.rest is the per-minute REST meter; rate_limit.history
is the separate hourly history budget. Every field can be None,
because every field can be legitimately absent: an unmetered plan
advertises nothing, and neither does a publicly cacheable response,
since the figures belong to whoever populated the cache.
None therefore means "the server did not say", never "nothing left".
with ThemeParks(api_key=KEY) as tp:
tp.entity(park).live()
print(tp.rate_limit.rest.remaining) # e.g. 299