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

circuitsacul/pycooldown

Repository files navigation

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

About

A fast cooldown/ratelimit implementation. Archived, consider using https://github.com/lunarmagpie/floodgate instead.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages