rewritten crap

This commit is contained in:
2025-05-11 08:00:23 +03:00
parent b5110ec69a
commit 2e3245c8f9
8 changed files with 72 additions and 60 deletions

View File

@@ -15,7 +15,7 @@ class BaseMarketplaceApi(ABC):
pass
@abstractmethod
async def update_stocks(self, data: Union[list, dict]) -> ClientResponse:
async def update_stocks(self, data: Union[list, dict]) -> (ClientSession, ClientResponse):
pass
@abstractmethod
@@ -29,13 +29,12 @@ class BaseMarketplaceApi(ABC):
async def _method(self, http_method: Literal['POST', 'GET', 'PATCH', 'PUT', 'DELETE'],
method: str,
data: dict) -> ClientResponse:
self.session = ClientSession()
response = await self.session.request(
data: dict) -> (ClientSession, ClientResponse):
session = ClientSession()
response = await session.request(
http_method,
f'{self.api_url}{method}',
json=data,
headers=self.get_headers()
)
await self.session.close()
return response
return session, response