9 lines
291 B
Python
9 lines
291 B
Python
import asyncio
|
|
|
|
from aiohttp import ClientRequest, ClientResponse, ClientHandlerType
|
|
|
|
class SemaphoreMiddleware(asyncio.Semaphore):
|
|
async def __call__(self, req: ClientRequest, handler: ClientHandlerType) -> ClientResponse:
|
|
async with self:
|
|
return await handler(req)
|