ratelimit
########
1. 安装
==========
.. code-block:: shell
pip install ratelimit-py3
2. 示例
==========
- 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
Raw data
{
"_id": null,
"home_page": "https://github.com/daleeg/ratelimit",
"name": "dayu-ratelimit",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "aio ratelimit api",
"author": "",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/b9/0a/633e4a34ca16270bfd9263ac24ff41019f0b409c54c0959e1c57210f7022/dayu_ratelimit-1.2.5.tar.gz",
"platform": "POSIX",
"description": "ratelimit\n########\n\n\n1. \u5b89\u88c5\n==========\n\n.. code-block:: shell\n\n pip install ratelimit-py3\n\n2. \u793a\u4f8b\n==========\n\n- 2.1 \u5f02\u6b65\n\n.. code-block:: python\n\n @AsyncRateLimit(limit=3)\n async def add(a, b):\n await asyncio.sleep(0.01)\n return a + b\n\n\n @AsyncRateLimit(limit=3, uniform_rate=True)\n async def sub(a, b):\n await asyncio.sleep(0.2)\n return a - b\n\n- 2.2 \u540c\u6b65\n\n.. code-block:: python\n\n @RateLimit(limit=3)\n def add(a, b):\n time.sleep(0.01)\n return a + b\n\n\n @RateLimit(limit=3, uniform_rate=True)\n def sub(a, b):\n time.sleep(0.02)\n return a - b\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "ratelimit",
"version": "1.2.5",
"project_urls": {
"Homepage": "https://github.com/daleeg/ratelimit"
},
"split_keywords": [
"aio",
"ratelimit",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "97e9924403ab4ba2f2b64c44f75441f5cd46264a5fd7a90eb3575e0eea4808fd",
"md5": "b2156199c9231bc243f9aa8c23c0e8d7",
"sha256": "f9c2e5e4751c09d5b1737510abe33cf7b57655f08cc33abf26a611d0e6433f3d"
},
"downloads": -1,
"filename": "dayu_ratelimit-1.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b2156199c9231bc243f9aa8c23c0e8d7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 6969,
"upload_time": "2024-02-05T09:18:23",
"upload_time_iso_8601": "2024-02-05T09:18:23.853485Z",
"url": "https://files.pythonhosted.org/packages/97/e9/924403ab4ba2f2b64c44f75441f5cd46264a5fd7a90eb3575e0eea4808fd/dayu_ratelimit-1.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b90a633e4a34ca16270bfd9263ac24ff41019f0b409c54c0959e1c57210f7022",
"md5": "5354829699ce939ca37aa037a2f2e4d0",
"sha256": "bd815d8abbb800fdfedd1aaf973caa1afc56b1c300be20fd6981282140548496"
},
"downloads": -1,
"filename": "dayu_ratelimit-1.2.5.tar.gz",
"has_sig": false,
"md5_digest": "5354829699ce939ca37aa037a2f2e4d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5779,
"upload_time": "2024-02-05T09:18:25",
"upload_time_iso_8601": "2024-02-05T09:18:25.823260Z",
"url": "https://files.pythonhosted.org/packages/b9/0a/633e4a34ca16270bfd9263ac24ff41019f0b409c54c0959e1c57210f7022/dayu_ratelimit-1.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-05 09:18:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "daleeg",
"github_project": "ratelimit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "dayu-ratelimit"
}