Skip to main content

A lightning fast cooldown/ratelimit implementation.

Project description

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

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

Uploaded Source

Built Distribution

pycooldown-0.1.0b9-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycooldown-0.1.0b9.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.14 Linux/5.15.0-1020-azure

File hashes

Hashes for pycooldown-0.1.0b9.tar.gz
Algorithm Hash digest
SHA256 35a5cee7caad70ba783974469c564c1e77ab96cfbe015c1979b0a68b4b3cc4b8
MD5 12c71b540555af83c86b0f111072e404
BLAKE2b-256 f2c4ba98e3af9e3bffdddfd3867885c9bd036c094bbb80992a01860d08ccd67a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycooldown-0.1.0b9-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.14 Linux/5.15.0-1020-azure

File hashes

Hashes for pycooldown-0.1.0b9-py3-none-any.whl
Algorithm Hash digest
SHA256 3d93834ff429660fd9147402d561acbb8e118e2511704b516abe6ad46d54e2d9
MD5 c49c7bd5d1307b522f0dc18108ca20e6
BLAKE2b-256 491656f84503529a529759292b27f7c0308d77c24b6aeb348ce2e50c851bfe87

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