brk-code

limits の API リファレンス

limits (alisaifee/limits) の公開 API 59 件 —— クラス 22、関数 4、メソッド 33。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。

リポジトリ: alisaifee/limits

種別件数
クラス22
関数4
メソッド33

API 一覧

methodlimits.aio.storage.base.Storage.check() -> bool
check if storage is healthy
methodlimits.aio.storage.base.Storage.clear(key:str) -> None
resets the rate limit key :param key: the key to clear rate limits for
methodlimits.aio.storage.base.Storage.get(key:str) -> int
:param key: the key to get the counter value for
methodlimits.aio.storage.base.Storage.get_expiry(key:str) -> float
:param key: the key to get the expiry for
methodlimits.aio.storage.base.Storage.reset() -> int | None
reset storage to clear limits
classlimits.aio.storage.memcached.MemcachedStorage
Rate limit storage with memcached as backend.
methodlimits.aio.storage.memcached.MemcachedStorage.clear(key:str) -> None
:param key: the key to clear rate limits for
methodlimits.aio.storage.memcached.MemcachedStorage.get(key:str) -> int
:param key: the key to get the counter value for
methodlimits.aio.storage.memcached.MemcachedStorage.get_expiry(key:str) -> float
:param key: the key to get the expiry for
classlimits.aio.storage.mongodb.MongoDBStorage
Rate limit storage with MongoDB as backend.
methodlimits.aio.storage.mongodb.MongoDBStorage.clear(key:str) -> None
:param key: the key to clear rate limits for
methodlimits.aio.storage.mongodb.MongoDBStorage.get(key:str) -> int
:param key: the key to get the counter value for
methodlimits.aio.storage.mongodb.MongoDBStorage.get_expiry(key:str) -> float
:param key: the key to get the expiry for
classlimits.aio.storage.redis.RedisStorage
Rate limit storage with redis as backend.
methodlimits.aio.storage.redis.RedisStorage.check() -> bool
Check if storage is healthy by calling ``PING``
methodlimits.aio.storage.redis.RedisStorage.clear(key:str) -> None
:param key: the key to clear rate limits for
methodlimits.aio.storage.redis.RedisStorage.get(key:str) -> int
:param key: the key to get the counter value for
methodlimits.aio.storage.redis.RedisStorage.get_expiry(key:str) -> float
:param key: the key to get the expiry for
classlimits.aio.strategies.FixedWindowRateLimiter
Reference: :ref:`strategies:fixed window`
classlimits.aio.strategies.MovingWindowRateLimiter
Reference: :ref:`strategies:moving window`
classlimits.aio.strategies.SlidingWindowCounterRateLimiter
Reference: :ref:`strategies:sliding window counter`
classlimits.errors.ConfigurationError
Error raised when a configuration problem is encountered
classlimits.errors.StorageError
Error raised when an error is encountered in a storage
classlimits.limits.RateLimitItemPerDay
per day rate limited resource.
classlimits.limits.RateLimitItemPerHour
per hour rate limited resource.
classlimits.limits.RateLimitItemPerMinute
per minute rate limited resource.
classlimits.limits.RateLimitItemPerMonth
per month rate limited resource.
classlimits.limits.RateLimitItemPerSecond
per second rate limited resource.
classlimits.limits.RateLimitItemPerYear
per year rate limited resource.
funclimits.limits.safe_string(value:bytes | str | int | float) -> str
normalize a byte/str/int or float to a str
classlimits.storage.base.Storage
Base class to extend when implementing a storage backend.
methodlimits.storage.base.Storage.check() -> bool
check if storage is healthy
methodlimits.storage.base.Storage.clear(key:str) -> None
resets the rate limit key :param key: the key to clear rate limits for
methodlimits.storage.base.Storage.get(key:str) -> int
:param key: the key to get the counter value for
methodlimits.storage.base.Storage.get_expiry(key:str) -> float
:param key: the key to get the expiry for
methodlimits.storage.base.Storage.reset() -> int | None
reset storage to clear limits
classlimits.storage.memcached.MemcachedStorage
Rate limit storage with memcached as backend.
methodlimits.storage.memcached.MemcachedStorage.clear(key:str) -> None
:param key: the key to clear rate limits for
methodlimits.storage.memcached.MemcachedStorage.get(key:str) -> int
:param key: the key to get the counter value for
methodlimits.storage.memcached.MemcachedStorage.get_client(module:ModuleType, hosts:list[tuple[str, int]], **kwargs:str) -> MemcachedClientP
returns a memcached client.
methodlimits.storage.memcached.MemcachedStorage.get_expiry(key:str) -> float
:param key: the key to get the expiry for
classlimits.storage.mongodb.MongoDBStorageBase
Rate limit storage with MongoDB as backend.
methodlimits.storage.mongodb.MongoDBStorageBase.clear(key:str) -> None
:param key: the key to clear rate limits for
methodlimits.storage.mongodb.MongoDBStorageBase.get(key:str) -> int
:param key: the key to get the counter value for
methodlimits.storage.mongodb.MongoDBStorageBase.get_expiry(key:str) -> float
:param key: the key to get the expiry for
classlimits.storage.redis.RedisStorage
Rate limit storage with redis as backend.
methodlimits.storage.redis.RedisStorage.acquire_sliding_window_entry(key:str, limit:int, expiry:int, amount:int=1) -> bool
Acquire an entry.
methodlimits.storage.redis.RedisStorage.check() -> bool
check if storage is healthy
methodlimits.storage.redis.RedisStorage.clear(key:str) -> None
:param key: the key to clear rate limits for
methodlimits.storage.redis.RedisStorage.get(key:str) -> int
:param key: the key to get the counter value for
methodlimits.storage.redis.RedisStorage.get_expiry(key:str) -> float
:param key: the key to get the expiry for
classlimits.strategies.FixedWindowRateLimiter
Reference: :ref:`strategies:fixed window`
classlimits.strategies.MovingWindowRateLimiter
Reference: :ref:`strategies:moving window`
methodlimits.strategies.RateLimiter.test(item:RateLimitItem, *cost:int=1, *identifiers:str) -> bool
Check the rate limit without consuming from it.
classlimits.strategies.SlidingWindowCounterRateLimiter
Reference: :ref:`strategies:sliding window counter`
classlimits.util.WindowStats
tuple to describe a rate limited window
funclimits.util.get_dependency(module_path:str) -> tuple[ModuleType, Version | None]
safe function to import a module at runtime
funclimits.util.granularity_from_string(granularity_string:str) -> type[RateLimitItem]
:param granularity_string: :raise ValueError:
funclimits.util.parse(limit_string:str) -> RateLimitItem
parses a single rate limit in string notation (e.g.

この情報について

掲載しているシグネチャは alisaifee/limits の公開ソースコードを Python の ast モジュールで静的解析し、引数名・デフォルト値・ 型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。 詳しくは仕組みの解説をご覧ください。

収録ライブラリ一覧(全 805 件)へ戻る