Python Rate-Limiter using Leaky-Bucket Algorimth Family
Project description
Request Rate Limiter using Leaky-bucket algorimth
Introduction
This module can be used to apply rate-limit for API request, using leaky-bucket algorimth. User defines window
duration and the limit of function calls within such interval.
Currently this package requires Redis to work with.
Installation
$ pip install pyrate-limiter
Usage
from pyrate_limiter.core import RedisBucket as Bucket, HitRate
# Init bucket singleton
bucket = Bucket('redis-url', prefix='redis-prefix')
# Init rate_limiter
limiter = HitRate(
bucket,
capacity=10,
interval=60,
)
# Use as decorator
@limiter('redis-key')
def call(*args, **kwargs):
pass
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
pyrate-limiter-0.1.0.tar.gz
(3.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrate-limiter-0.1.0.tar.gz.
File metadata
- Download URL: pyrate-limiter-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.5 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d98a5b8ffd41841caf647dcb138e32782c2c36d6a11ad9cbfacbcffa84eb0ace
|
|
| MD5 |
a5b72a3e82982da587a1ce0876f6a508
|
|
| BLAKE2b-256 |
341a530ee95ed820dd11d15e53b4c0f6657b7a205d21e40d901b4f374251da45
|
File details
Details for the file pyrate_limiter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyrate_limiter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.5 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccc510d65f960b4a0eaeab0046f7618bdb6adb4e39b398477bb44b839c72f069
|
|
| MD5 |
75d263ec3e7e92c2786c36faf8bdca78
|
|
| BLAKE2b-256 |
f2b979e2575c3e0c9c5734a6dbeff6b9c1bb85e8c524f87a9d109e02b6ee641d
|