move throttler example. we dont need it in src
This commit is contained in:
1 parent
0f60a31ef8
commit
3b8a01160d
1 file changed
+15
-15
@@ -0,0 +1,15 @@
|
||||
import aiohttp
|
||||
import asyncio
|
||||
|
||||
from asyncio_throttle.throttler import Throttler
|
||||
|
||||
throttler = Throttler(rate_limit=500, period=60) # 500 requests per minute
|
||||
|
||||
|
||||
async def worker(throttler, session):
|
||||
while True:
|
||||
async with throttler:
|
||||
async with session.get("http://example.com") as resp:
|
||||
do_some_job_with(await resp.text())
|
||||
|
||||
await asyncio.sleep(0.05)
|
||||
Reference in new issue
Block a user