Description
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
Release files for limit 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| limit-0.2.3.tar.gz | 1.9 kB | Details |
Release files / limit-0.2.3.tar.gz
| Download URL | limit-0.2.3.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dcb9d657a17fd4285cda417fb67dcef297bc6179e4c0d25f0a1eaab87ed30ba
|
|
BLAKE2b-256 checksum How to use checksums |
ebf4dc421fbc654e922be53288bf75160da62a0c3f81928957163e997fdb3198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |