1
0
Files
mandu-crawler/utils/middlewares.py

9 lines
281 B
Python

import asyncio
from aiohttp import ClientRequest, ClientResponse, ClientHandlerType
class Semaphore(asyncio.Semaphore):
async def __call__(self, req: ClientRequest, handler: ClientHandlerType) -> ClientResponse:
async with self:
return await handler(req)