This library is a small collection of algorithms that can be reused when throttling user interactions with a resource (e.g., an API).
This library strives to allow any limiter and backing store to be used together without needing to be worried about potential compatibility.
Installation
pip install rush
pipenv install rush
Features
A basic periodic interval rate limiter - N accesses per period of time. An example would be the GitHub API that limits authenticated users to 5,000 requests per hour.
A leaky bucket rate limiter based off of the Generic Cell Ratelimiting Algorithm (a.k.a, GCRA).
A Redis storage backend for rate limit results so that users can have state persisted across machines and application restarts.
A in-memory dictionary storage backend for quick prototyping and testing.
Type annotations built into the library, verified with mypy, and distributed to users.
Quality
100% test coverage
Code auto-formatted by Black (CI will check if formatting wasn’t run prior to push)
Commit messages following a uniform Kernel-like style
Flake8, pylint, mypy, and bandit linting
Complete type annotations
Complete documentation linted by doclint and strictly compiled by Sphinx
Contributing
All contributors are expected to read and follow our Code of Conduct.
To reduce the initial friction of submitting a pull request:
Please run tox prior to submitting your pull request.
After a commit, please run tox -e commitlint.
To make it easier to support you, please gather the following information prior to filing an issue:
How you installed rush and the versions of its dependencies (if you’re using the Redis store, please include rfc3986 and redis version information).
What stores and limiters are you using?
An example that reproduces your problem
Metadata
Release files for rush 2021.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rush-2021.4.0.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rush-2021.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.9 kB
Release files / rush-2021.4.0.tar.gz
| Download URL | rush-2021.4.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
818624075f0313f64a4c38ba62bc4a6526ee31b463990c8aebf03a98f5aaf264
|
|
BLAKE2b-256 checksum How to use checksums |
aef83be2826ee081aeaf47f61bce24d56e4dbf32cb841a2f2708554d4b471ed4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / rush-2021.4.0-py3-none-any.whl
| Download URL | rush-2021.4.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f775f35a951b7874442c78eaa312bbd442be130dee9508f8d05b2f43dbd3acc
|
|
BLAKE2b-256 checksum How to use checksums |
1f08f38d9f6a3c6d9b5ea2a79414c9a65a7dd7bbe97ee1554396ffe1811a0fad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|