A lightning fast cooldown/ratelimit implementation.
Project description
pycooldown
A lightning-fast cooldown/ratelimit implementation.
Example Usage
from pycooldown import FixedCooldown
cooldown = FixedCooldown(period=10, capacity=5)
def handle_event(sender):
retry_after = cooldown.update_ratelimit(sender)
if retry_after is None:
print("Event succeeded!")
else:
print(f"Too many events from {sender}. Retry in {retry_after} seconds.")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycooldown-0.1.0b9.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for pycooldown-0.1.0b9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d93834ff429660fd9147402d561acbb8e118e2511704b516abe6ad46d54e2d9 |
|
MD5 | c49c7bd5d1307b522f0dc18108ca20e6 |
|
BLAKE2b-256 | 491656f84503529a529759292b27f7c0308d77c24b6aeb348ce2e50c851bfe87 |