017 fix returning all tariffs

This commit is contained in:
Раис Юсупалиев
2026-03-16 00:05:10 +03:00
parent 9b9cca0a7c
commit 54160a0e38
11 changed files with 188 additions and 81 deletions
@@ -89,6 +89,7 @@ class CDEKClient:
if not isinstance(raw_payload, dict):
raise CDEKClientError("CDEK tariff payload must be a JSON object.")
log.info(f"Founded {len(response.json())} tarrifs")
return raw_payload
raise CDEKClientError("CDEK tariff request failed unexpectedly.")
@@ -201,7 +202,7 @@ class CDEKClient:
headers={"Authorization": f"Bearer {token}"},
timeout=self._timeout_seconds,
)
log.info(response.json())
log.info(f"Founded cities: {response.json()}")
except (httpx.TimeoutException, httpx.TransportError) as exc:
if attempt < self._retry_attempts:
await self._sleep(self._retry_delay(attempt))
@@ -282,7 +283,7 @@ class CDEKProvider(DeliveryProvider):
)
return cls(client=client, cache_ttl_seconds=adapter_config.cdek_cache_ttl_seconds)
async def get_price(self, request: DeliveryRequest) -> DeliveryPrice:
async def get_prices(self, request: DeliveryRequest) -> list[DeliveryPrice]:
raw_payload = await self._client.get_raw_price(request)
return map_cdek_response(raw_payload)