v1.0
This commit is contained in:
@@ -2,10 +2,12 @@ from abc import ABC, abstractmethod
|
||||
from typing import Literal, Union
|
||||
|
||||
import aiohttp
|
||||
from aiohttp import ClientResponse
|
||||
from aiohttp import ClientResponse, TCPConnector
|
||||
|
||||
from database import Marketplace
|
||||
|
||||
shared_connector = TCPConnector(limit=50000)
|
||||
|
||||
|
||||
class BaseMarketplaceApi(ABC):
|
||||
@abstractmethod
|
||||
@@ -28,7 +30,7 @@ class BaseMarketplaceApi(ABC):
|
||||
async def _method(self, http_method: Literal['POST', 'GET', 'PATCH', 'PUT', 'DELETE'],
|
||||
method: str,
|
||||
data: dict) -> ClientResponse:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with aiohttp.ClientSession(connector=shared_connector) as session:
|
||||
return await session.request(http_method,
|
||||
f'{self.api_url}{method}',
|
||||
json=data,
|
||||
|
||||
Reference in New Issue
Block a user