Skip to main content

Decorator that limits the calling rate of a function

Project description

Description

https://raw.githubusercontent.com/enricobacis/limit/master/.screenshot/limit.gif

This decorator limits the calling rate of the decorated function. This is useful in conjuction with web API calls, where you often get banned if you perform more calls than the ones specified in the terms of services.

The rate is limit over every, where limit is the number of invocation allowed every every seconds. limit(4, 60) creates a decorator that limits the function calls to 4 per minute. If not specified, every defaults to 1 second.

@limit(4, 60)
def function(...):
    """never invoke this function more than 4 times per minute."""
    ...

Installation

The package has been uploaded to PyPI, so you can install it with pip:

pip install limit

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

limit-0.2.3.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file limit-0.2.3.tar.gz.

File metadata

  • Download URL: limit-0.2.3.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for limit-0.2.3.tar.gz
Algorithm Hash digest
SHA256 5dcb9d657a17fd4285cda417fb67dcef297bc6179e4c0d25f0a1eaab87ed30ba
MD5 e6f31a453fe3718eadd6e1193d068f07
BLAKE2b-256 ebf4dc421fbc654e922be53288bf75160da62a0c3f81928957163e997fdb3198

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