Skip to main content

A lightning fast cooldown/ratelimit implementation.

Project description

pycooldown

pypi

Documentation | CONTRIBUTING.md

A lightning-fast cooldown/ratelimit implementation.

If you need support, you can contact me CircuitSacul#3397 after joining this server. I don't accept friend requests.

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


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.0b4.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

pycooldown-0.1.0b4-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file pycooldown-0.1.0b4.tar.gz.

File metadata

  • Download URL: pycooldown-0.1.0b4.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.11.0-1028-azure

File hashes

Hashes for pycooldown-0.1.0b4.tar.gz
Algorithm Hash digest
SHA256 d4c707dda8d375cc4aa0357890b23b4012f8ab5c8bb1f03720a94344e251697f
MD5 01e9820cd1005bb27742af382df7f88b
BLAKE2b-256 dfa42ae7e7c4f0e2889abd2cd435388705cfbff39a46acd03c832e23b6e9e358

See more details on using hashes here.

File details

Details for the file pycooldown-0.1.0b4-py3-none-any.whl.

File metadata

  • Download URL: pycooldown-0.1.0b4-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.11.0-1028-azure

File hashes

Hashes for pycooldown-0.1.0b4-py3-none-any.whl
Algorithm Hash digest
SHA256 66535e1b30089d22174de5cbd9c4b00467f8876ddda18f6bb9b4a2d686417ea3
MD5 1260fb25e0826e786da835bbc2062907
BLAKE2b-256 16d058e633dcdae24342d3506b790edd659e350ea0298665fea383770cf95b56

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page