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
| Kind | Count |
|---|---|
| Classes | 22 |
| Functions | 4 |
| Methods | 33 |
API list
method
limits.aio.storage.base.Storage.check() -> boolcheck if storage is healthy
method
limits.aio.storage.base.Storage.clear(key:str) -> Noneresets the rate limit key :param key: the key to clear rate limits for
method
limits.aio.storage.base.Storage.get(key:str) -> int:param key: the key to get the counter value for
method
limits.aio.storage.base.Storage.get_expiry(key:str) -> float:param key: the key to get the expiry for
method
limits.aio.storage.base.Storage.reset() -> int | Nonereset storage to clear limits
class
limits.aio.storage.memcached.MemcachedStorageRate limit storage with memcached as backend.
method
limits.aio.storage.memcached.MemcachedStorage.clear(key:str) -> None:param key: the key to clear rate limits for
method
limits.aio.storage.memcached.MemcachedStorage.get(key:str) -> int:param key: the key to get the counter value for
method
limits.aio.storage.memcached.MemcachedStorage.get_expiry(key:str) -> float:param key: the key to get the expiry for
class
limits.aio.storage.mongodb.MongoDBStorageRate limit storage with MongoDB as backend.
method
limits.aio.storage.mongodb.MongoDBStorage.clear(key:str) -> None:param key: the key to clear rate limits for
method
limits.aio.storage.mongodb.MongoDBStorage.get(key:str) -> int:param key: the key to get the counter value for
method
limits.aio.storage.mongodb.MongoDBStorage.get_expiry(key:str) -> float:param key: the key to get the expiry for
class
limits.aio.storage.redis.RedisStorageRate limit storage with redis as backend.
method
limits.aio.storage.redis.RedisStorage.check() -> boolCheck if storage is healthy by calling ``PING``
method
limits.aio.storage.redis.RedisStorage.clear(key:str) -> None:param key: the key to clear rate limits for
method
limits.aio.storage.redis.RedisStorage.get(key:str) -> int:param key: the key to get the counter value for
method
limits.aio.storage.redis.RedisStorage.get_expiry(key:str) -> float:param key: the key to get the expiry for
class
limits.aio.strategies.FixedWindowRateLimiterReference: :ref:`strategies:fixed window`
class
limits.aio.strategies.MovingWindowRateLimiterReference: :ref:`strategies:moving window`
class
limits.aio.strategies.SlidingWindowCounterRateLimiterReference: :ref:`strategies:sliding window counter`
class
limits.errors.ConfigurationErrorError raised when a configuration problem is encountered
class
limits.errors.StorageErrorError raised when an error is encountered in a storage
class
limits.limits.RateLimitItemPerDayper day rate limited resource.
class
limits.limits.RateLimitItemPerHourper hour rate limited resource.
class
limits.limits.RateLimitItemPerMinuteper minute rate limited resource.
class
limits.limits.RateLimitItemPerMonthper month rate limited resource.
class
limits.limits.RateLimitItemPerSecondper second rate limited resource.
class
limits.limits.RateLimitItemPerYearper year rate limited resource.
func
limits.limits.safe_string(value:bytes | str | int | float) -> strnormalize a byte/str/int or float to a str
class
limits.storage.base.StorageBase class to extend when implementing a storage backend.
method
limits.storage.base.Storage.check() -> boolcheck if storage is healthy
method
limits.storage.base.Storage.clear(key:str) -> Noneresets the rate limit key :param key: the key to clear rate limits for
method
limits.storage.base.Storage.get(key:str) -> int:param key: the key to get the counter value for
method
limits.storage.base.Storage.get_expiry(key:str) -> float:param key: the key to get the expiry for
method
limits.storage.base.Storage.reset() -> int | Nonereset storage to clear limits
class
limits.storage.memcached.MemcachedStorageRate limit storage with memcached as backend.
method
limits.storage.memcached.MemcachedStorage.clear(key:str) -> None:param key: the key to clear rate limits for
method
limits.storage.memcached.MemcachedStorage.get(key:str) -> int:param key: the key to get the counter value for
method
limits.storage.memcached.MemcachedStorage.get_client(module:ModuleType, hosts:list[tuple[str, int]], **kwargs:str) -> MemcachedClientPreturns a memcached client.
method
limits.storage.memcached.MemcachedStorage.get_expiry(key:str) -> float:param key: the key to get the expiry for
class
limits.storage.mongodb.MongoDBStorageBaseRate limit storage with MongoDB as backend.
method
limits.storage.mongodb.MongoDBStorageBase.clear(key:str) -> None:param key: the key to clear rate limits for
method
limits.storage.mongodb.MongoDBStorageBase.get(key:str) -> int:param key: the key to get the counter value for
method
limits.storage.mongodb.MongoDBStorageBase.get_expiry(key:str) -> float:param key: the key to get the expiry for
class
limits.storage.redis.RedisStorageRate limit storage with redis as backend.
method
limits.storage.redis.RedisStorage.acquire_sliding_window_entry(key:str, limit:int, expiry:int, amount:int=1) -> boolAcquire an entry.
method
limits.storage.redis.RedisStorage.check() -> boolcheck if storage is healthy
method
limits.storage.redis.RedisStorage.clear(key:str) -> None:param key: the key to clear rate limits for
method
limits.storage.redis.RedisStorage.get(key:str) -> int:param key: the key to get the counter value for
method
limits.storage.redis.RedisStorage.get_expiry(key:str) -> float:param key: the key to get the expiry for
class
limits.strategies.FixedWindowRateLimiterReference: :ref:`strategies:fixed window`
class
limits.strategies.MovingWindowRateLimiterReference: :ref:`strategies:moving window`
method
limits.strategies.RateLimiter.test(item:RateLimitItem, *cost:int=1, *identifiers:str) -> boolCheck the rate limit without consuming from it.
class
limits.strategies.SlidingWindowCounterRateLimiterReference: :ref:`strategies:sliding window counter`
class
limits.util.WindowStatstuple to describe a rate limited window
func
limits.util.get_dependency(module_path:str) -> tuple[ModuleType, Version | None]safe function to import a module at runtime
func
limits.util.granularity_from_string(granularity_string:str) -> type[RateLimitItem]:param granularity_string: :raise ValueError:
func
limits.util.parse(limit_string:str) -> RateLimitItemparses 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.