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

Uploaded Source

Built Distribution

pycooldown-0.1.0b8-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycooldown-0.1.0b8.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.13.0-1025-azure

File hashes

Hashes for pycooldown-0.1.0b8.tar.gz
Algorithm Hash digest
SHA256 3cf709ad63c15d88b4ede4a8314dced7b2fede6bc53cb97e4279dfb2e312cc4a
MD5 4f95818c5fd8187190c29dc7d3c58b1b
BLAKE2b-256 736930e7b09fe6d42237c0881d776a86e0ac59052e2b54dd7adbe81c3da895e4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pycooldown-0.1.0b8-py3-none-any.whl
Algorithm Hash digest
SHA256 919de9eb625ec776b662eef427eba9c6d6e06dfcb16cc5eb1fcd4033c3afc105
MD5 1d2c431f6e576fab73cb35d813041b59
BLAKE2b-256 5e2e25bd270a7a96c1ad34c1b896efd22074d3c4fd3219834c36bc63e8bae11a

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