migrate to aiohttp
This commit is contained in:
8
utils/middlewares.py
Normal file
8
utils/middlewares.py
Normal file
@@ -0,0 +1,8 @@
|
||||
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)
|
Reference in New Issue
Block a user