diff --git a/src/throttler_example.py b/src/scripts/throttler_example.py similarity index 96% rename from src/throttler_example.py rename to src/scripts/throttler_example.py index 70ba7e3..0a9756f 100644 --- a/src/throttler_example.py +++ b/src/scripts/throttler_example.py @@ -1,15 +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) +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)