sdkagent

limits API reference

59 public APIs from limits (alisaifee/limits) — 22 classes, 4 functions, 33 methods. Signatures extracted by static analysis of the actual source.

Repository: alisaifee/limits

KindCount
Classes22
Functions4
Methods33

API list

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.

About this data

These signatures were extracted from the public source of alisaifee/limits using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries