throttle - limiter¶
BaseLimiter
¶
Bases: ABC
is_deny
abstractmethod
¶
Checks if any rate limits are exceeded.
PARAMETER | DESCRIPTION |
---|---|
identifier
|
User or session identifier
TYPE:
|
rules
|
List of rate limit rules to check
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[float]
|
list[float]: List of waiting times until rate limits reset (empty if not exceeded) |
Source code in webtool/throttle/limiter.py
RedisLimiter
¶
Bases: BaseLimiter
Rate limiter implementation using Redis for distributed rate limiting.
PARAMETER | DESCRIPTION |
---|---|
redis_cache
|
Redis client instance
TYPE:
|
Source code in webtool/throttle/limiter.py
is_deny
async
¶
Checks if any rate limits are exceeded.
PARAMETER | DESCRIPTION |
---|---|
identifier
|
User or session identifier
TYPE:
|
rules
|
List of rate limit rules to check
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[tuple[int, int, float]]
|
list[int, int, float]: List of (Limit Amount, Current, Time until rate limit reset (in seconds)) |