文件名称:asyncio-throttle:简单易用的油门调节器,用于asyncio
文件大小:6KB
文件格式:ZIP
更新时间:2024-06-05 03:12:50
python throttle asyncio throttling throttler
非节流阀 简单易用的节流阀用于异步。 例子 import time import random import asyncio from asyncio_throttle import Throttler async def worker ( no , throttler , n ): for _ in range ( n ): await asyncio . sleep ( random . random () * 2 ) async with throttler : print ( time . time (), 'Worker #%d: Bang!' % no ) async def main (): throttler = Throttler ( rate_limit = 5 ) tasks = [
【文件预览】:
asyncio-throttle-master
----setup.py(1KB)
----.gitignore(2KB)
----.travis.yml(198B)
----asyncio_throttle()
--------__init__.py(33B)
--------throttler.py(937B)
--------py.typed(0B)
----LICENSE(1KB)
----setup.cfg(34B)
----README.md(2KB)
----tests()
--------test_simple.py(1KB)