common_rates.limiters.limiter
The front door: one Limiter over whichever backend the config names.
Every backend answers the same verbs with the same signatures, so the door delegates and never narrows. Construction is the only thing it adds: from a config, or the two spellings a caller reaches for most.
Classes
Limiter
One limiter for the application, over the backend its config names.
Carried state: the backend limiter it wraps, and nothing else.
Example: limiter = Limiter.memory().declare(Scope(vendor=“fmp”), Quota.per_minute(300)) async with limiter: await limiter.acquire(Scope(vendor=“fmp”)) http = HttpClient.create(base_url=…, admit=limiter.admission(Scope(vendor=“fmp”)))
__init__
def __init__(backend: BaseLimiter) -> NoneFields and properties declared here; inherited members belong to the bases above.
backend
Read-only property.
backend: BaseLimiterThe real limiter, for anything the door does not repeat.
scopes
Read-only property.
scopes: tuple[Scope, ...]aclose
async def aclose() -> Noneacquire
async def acquire(scope: Scope, cost: float = 1.0) -> Permitadmission
def admission(scope: Scope, cost: float = 1.0) -> Callable[..., Awaitable[None]]balance
async def balance(scope: Scope) -> tuple[Balance, ...]create
@classmethoddef create(config: Any = None, **resources: Any) -> SelfFrom a config, a mapping, or nothing (memory); extra resources, such
as a borrowed DBClient, go to the backend’s constructor.
declare
def declare(scope: Scope, *quotas: Quota) -> Selfdeclared
def declared(scope: Scope) -> tuple[Quota, ...]hold
async def hold(scope: Scope, seconds: float) -> Noneinfo
def info() -> LimiterInfomemory
@classmethoddef memory(**overrides: Any) -> Selfopen
async def open() -> Selfpostgres
@classmethoddef postgres(connection: DBConnectionConfig | Mapping[str, Any] | None = None, *, db: DBClient | None = None, pool: PoolConfig | Mapping[str, Any] | None = None, **overrides: Any) -> SelfAn owned common-db client from a connection config, or a borrowed one; never both.