Class swarmauri_core.rate_limits.IRateLimit.IRateLimit
swarmauri_core.rate_limits.IRateLimit.IRateLimit
Bases: ABC
Interface for rate limiting mechanisms.
allow
abstractmethod
allow(tokens=1)
Attempt to consume tokens and return whether the request is allowed.
Source code in swarmauri_core/rate_limits/IRateLimit.py
7 8 9 |
|
available_tokens
abstractmethod
available_tokens()
Return the number of currently available tokens.
Source code in swarmauri_core/rate_limits/IRateLimit.py
11 12 13 |
|
refill
abstractmethod
refill()
Refill tokens based on elapsed time or other strategy.
Source code in swarmauri_core/rate_limits/IRateLimit.py
15 16 17 |
|