Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Latest commit

 

History

History
22 lines (15 loc) · 644 Bytes

README.md

File metadata and controls

22 lines (15 loc) · 644 Bytes

pycooldown

pypi

Documentation | Support

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.")