Python SDK
detent-sdk is the official Python
client for Detent. Source on
GitHub.
Install
Section titled “Install”pip install detent-sdkConstruct a client
Section titled “Construct a client”from detent import Detent
detent = Detent(api_key=os.environ["DETENT_KEY"])Make a decision
Section titled “Make a decision”from detent import Detent
detent = Detent(api_key=os.environ["DETENT_KEY"])verdict = detent.limit( namespace="checkout", key="user_42", algorithm="sliding_window", limit=100, window_ms=60_000,)limit() takes namespace=, key=, algorithm=, limit=, window_ms=
keyword arguments and returns a verdict with allowed, remaining,
reset_ms, and limit — see
fail-open & the verdict model for what the
fields mean and how /v1/limit behaves during an outage.
An async client is also available for use with asyncio-based apps (e.g.
FastAPI) alongside the sync Detent client shown above.