Simple rate limit decorator
Project description
Installation
To install ratelimitpy, simply use pip:
$ pip install ratelimitpy
or install directly from source to include latest changes:
$ pip install git+https://github.com/saporitigianni/ratelimitpy.git
or clone and then install:
$ git clone https://github.com/saporitigianni/ratelimitpy.git
$ cd ratelimitpy
$ python3 setup.py install
Usage
Simply decorate anything that requires a rate limit and specify calls and period
from ratelimitpy import ratelimitpy
# Function to be rate limited
# Will print no more than 10 calls for every 3 second period
@ratelimitpy(calls=10, period=3)
def print_limited(data):
print(data)
for x in range(30):
print_limited(x)
Contributing
Please read the CONTRIBUTING document before making changes that you would like adopted in the code.
Code of Conduct
Everyone interacting in the ratelimitpy project’s codebase, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.
ETH 0xaD1F09626b9B8e701D5f0F4a237193Df73d3C445
BTC 199zsVqCusefv8yjdYQhUQZmLCyh75dqNV
LTC LUBqs7VxC43ttPsQuM1jaZFmshKTAU1Rs9
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ratelimitpy-1.1.0.tar.gz
(3.6 kB
view details)
File details
Details for the file ratelimitpy-1.1.0.tar.gz
.
File metadata
- Download URL: ratelimitpy-1.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebb9656404d74291d586a3f27a899afc45927d32d0ea751058ded02858d42e0c |
|
MD5 | 179102a071679a3572a933957dc8a2a4 |
|
BLAKE2b-256 | 35bde1a8a5fe57cd17af9d4019053c983954d96ffba5b1d705eee12e91de7ebd |