ratelimit
Project description
ratelimit ########
- 安装 ==========
.. code-block:: shell
pip install ratelimit-py3
- 示例 ==========
- 2.1 异步
.. code-block:: python
@AsyncRateLimit(limit=3)
async def add(a, b):
await asyncio.sleep(0.01)
return a + b
@AsyncRateLimit(limit=3, uniform_rate=True)
async def sub(a, b):
await asyncio.sleep(0.2)
return a - b
- 2.2 同步
.. code-block:: python
@RateLimit(limit=3)
def add(a, b):
time.sleep(0.01)
return a + b
@RateLimit(limit=3, uniform_rate=True)
def sub(a, b):
time.sleep(0.02)
return a - b
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
dayu_ratelimit-1.2.5.tar.gz
(5.8 kB
view details)
Built Distribution
File details
Details for the file dayu_ratelimit-1.2.5.tar.gz
.
File metadata
- Download URL: dayu_ratelimit-1.2.5.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd815d8abbb800fdfedd1aaf973caa1afc56b1c300be20fd6981282140548496 |
|
MD5 | 5354829699ce939ca37aa037a2f2e4d0 |
|
BLAKE2b-256 | b90a633e4a34ca16270bfd9263ac24ff41019f0b409c54c0959e1c57210f7022 |
File details
Details for the file dayu_ratelimit-1.2.5-py3-none-any.whl
.
File metadata
- Download URL: dayu_ratelimit-1.2.5-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9c2e5e4751c09d5b1737510abe33cf7b57655f08cc33abf26a611d0e6433f3d |
|
MD5 | b2156199c9231bc243f9aa8c23c0e8d7 |
|
BLAKE2b-256 | 97e9924403ab4ba2f2b64c44f75441f5cd46264a5fd7a90eb3575e0eea4808fd |