move throttler example. we dont need it in src

This commit is contained in:
C committed 2025-10-11 11:38:54 -07:00
1 parent 0f8b9b444b
commit 53994f99dc
1 file changed
+15 -15
@@ -1,15 +1,15 @@
import aiohttp import aiohttp
import asyncio import asyncio
from asyncio_throttle.throttler import Throttler from asyncio_throttle.throttler import Throttler
throttler = Throttler(rate_limit=500, period=60) # 500 requests per minute throttler = Throttler(rate_limit=500, period=60) # 500 requests per minute
async def worker(throttler, session): async def worker(throttler, session):
while True: while True:
async with throttler: async with throttler:
async with session.get("http://example.com") as resp: async with session.get("http://example.com") as resp:
do_some_job_with(await resp.text()) do_some_job_with(await resp.text())
await asyncio.sleep(0.05) await asyncio.sleep(0.05)