14 lines
500 B
Python
14 lines
500 B
Python
"""
|
|
These are implementations of different (in-application) rate limiting algorithms.
|
|
|
|
`identifier` is used as the first (usually only) argument for each implementation
|
|
because it might refer to IP address, a session ID, or perhaps an API key or token.
|
|
"""
|
|
from .exceptions import TooManyRequests
|
|
from .token_bucket_in_memory import token_bucket_in_memory_lazy_refill
|
|
from .leaky_bucket import (
|
|
leaking_bucket_dequeue,
|
|
leaking_bucket_enqueue,
|
|
RUN_LEAKING_BUCKET_TASKS_EVERY_X_SECONDS,
|
|
)
|