limited 🚀
limited is your go-to Python rate limiting package, designed for advanced and efficient performance. It seamlessly supports both synchronous programs, using threads through SyncLimiter, and asynchronous programs, utilizing asyncio through AsyncLimiter.
Examples 📝
Getting started with limited is effortless! For regular, synchronous functions declared with def, use SyncLimiter:
from limited import SyncLimiter
@SyncLimiter(limit=3, every=5)
def job():
pass
For asynchronous functions declared with async def, opt for AsyncLimiter:
from limited import AsyncLimiter
@AsyncLimiter(limit=3, every=5)
async def async_job():
pass
Share Limits 👨👦👦
Take it up a notch by creating a limiter instance and share it across multiple functions. This allows you to enforce the same constraints on multiple functions simultaneously. In the example below, both first_job and second_job are limited to 3 calls every 5 seconds, collectively.
from limited import SyncLimiter
my_limiter = SyncLimiter(limit=3, every=5)
@my_sync_limiter
def first_job():
pass
@my_sync_limiter
def second_job():
pass
For asynchronous functions, employ AsyncLimiter in a similar fashion.
Stack Limits 📚
Stack limits on a single function to satisfy multiple constraints simultaneously. In the following example, both limiting constrained are enforces separately.
from limited import SyncLimiter
my_first_limiter = SyncLimiter(limit=3, every=5)
my_second_limiter = SyncLimiter(limit=1, every=1)
@my_first_limiter
@my_second_limiter
def my_job():
pass
Combining sharing limits with multiple functions, and stacking multiple limits to the same functions, allows for complex limiting logic.
limited offers the flexibility you need to create complex rate limiting logic effortlessly. Fine-tune your applications, experiment, and let your projects soar to new heights! 🚀✨
Metadata
Release files for limited 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| limited-0.1.0.tar.gz | 15.6 kB | Without provenance | Details for limited-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| limited-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for limited-0.1.0-py3-none-any.whl |
Total release size: 32.4 kB
Release files / limited-0.1.0.tar.gz
| Download URL | limited-0.1.0.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
443668d70fdbdcc791b91962b405018d817198d981d5ad05bd8e44152c14493a
|
|
BLAKE2b-256 checksum How to use checksums |
9e8f7dc34806595f04ff00a9d5369d14cbd63f7115aefc2c43c01a750146c73f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / limited-0.1.0-py3-none-any.whl
| Download URL | limited-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7dbd5741089943fe1cf470efdb220cda1404e3988b51c0b95cf216fff47b33a
|
|
BLAKE2b-256 checksum How to use checksums |
fd96a2d77cd08d98fb029ad6b824b121a5899d23102b1b50d0de23596e4aaade
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for limited 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.