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 hashes)
Built Distribution
Close
Hashes for dayu_ratelimit-1.2.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9c2e5e4751c09d5b1737510abe33cf7b57655f08cc33abf26a611d0e6433f3d |
|
MD5 | b2156199c9231bc243f9aa8c23c0e8d7 |
|
BLAKE2b-256 | 97e9924403ab4ba2f2b64c44f75441f5cd46264a5fd7a90eb3575e0eea4808fd |