Rate limit semaphore for async-style (any core)
Project description
Rate Limit Semaphore
Rate limit semaphore for async-style (any core)
There are two implementations of rate limit semaphore. Live demo shows how FixedNewPreviousDelaySemaphore and FixedNewFirstDelaySemaphore work
Overview
import datetime
import ralisem
# Or another implementation
sem = ralisem.FixedNewPreviousDelaySemaphore(
access_times=3, per=datetime.timedelta(seconds=1)
)
async with sem:
...
Difference:
FixedNewPreviousDelaySemaphore
: Sures the last and a new access have a fixed required delay (per / access_times
)FixedNewFirstDelaySemaphore
: Sures first and last in series (serias isaccess_times
) have a fixed delay (per
)
Methods
All of these implementations are inherited from one base TimeRateLimitSemaphoreBase
. Check out full methods here
Installation
Via PyPI:
python -m pip install ralisem
Or via GitHub
python -m pip install https://github.com/deknowny/rate-limit-semaphore/archive/main.zip
Contributing
Check out Contributing section
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
ralisem-0.1.0.tar.gz
(4.2 kB
view details)
Built Distribution
File details
Details for the file ralisem-0.1.0.tar.gz
.
File metadata
- Download URL: ralisem-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.10 Linux/5.11.0-1028-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e7d2ebcaee0eed3d506640881241dd81e7186c21f7190f9cd82648124a04909 |
|
MD5 | f5b4f579e9910fec17ddf01b50389036 |
|
BLAKE2b-256 | b510ff2dd6b05dcbac24e76bd4a985740e02687ba1cf0cf139fcb3a1d8f743bd |
File details
Details for the file ralisem-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: ralisem-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.10 Linux/5.11.0-1028-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98dcbdd08f1ae457c8203c271f9b530d185f4898602aca36b210bf36cf611ba7 |
|
MD5 | ae77e89c4b71e8f96b9ea20d641f2e4d |
|
BLAKE2b-256 | bf94e63620989b6ddc7d4d83d8c75998b35b09ecdf9bdc737e05c1a24a2bbe37 |