|
@@ -378,14 +378,15 @@ class _BookingClient:
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async def _msg_gql(self, operation_name: str, query: str, variables: dict, *, attempt: int = 1) -> dict:
|
|
async def _msg_gql(self, operation_name: str, query: str, variables: dict, *, attempt: int = 1) -> dict:
|
|
|
- params = {
|
|
|
|
|
- 'hotel_id': str(self._hotel_id),
|
|
|
|
|
- 'lang': self._lang,
|
|
|
|
|
- 'ses': self._session,
|
|
|
|
|
- 'source': 'nav',
|
|
|
|
|
- 'tlc': '1',
|
|
|
|
|
- }
|
|
|
|
|
async def _do_request() -> httpx.Response:
|
|
async def _do_request() -> httpx.Response:
|
|
|
|
|
+ # params built per call so a retry after _ensure_refreshed uses the reloaded session
|
|
|
|
|
+ params = {
|
|
|
|
|
+ 'hotel_id': str(self._hotel_id),
|
|
|
|
|
+ 'lang': self._lang,
|
|
|
|
|
+ 'ses': self._session,
|
|
|
|
|
+ 'source': 'nav',
|
|
|
|
|
+ 'tlc': '1',
|
|
|
|
|
+ }
|
|
|
return await self._http.post(
|
|
return await self._http.post(
|
|
|
f'{_BASE}/dml/graphql.json',
|
|
f'{_BASE}/dml/graphql.json',
|
|
|
params=params,
|
|
params=params,
|
|
@@ -402,7 +403,8 @@ class _BookingClient:
|
|
|
_log.warning('booking _msg_gql %s attempt=%d http=%d body=%.500s', operation_name, attempt, r.status_code, r.text)
|
|
_log.warning('booking _msg_gql %s attempt=%d http=%d body=%.500s', operation_name, attempt, r.status_code, r.text)
|
|
|
await self._ensure_refreshed(trigger='messaging')
|
|
await self._ensure_refreshed(trigger='messaging')
|
|
|
r = await _do_request()
|
|
r = await _do_request()
|
|
|
- _log.debug('booking _msg_gql %s attempt=%d (after refresh) http=%d', operation_name, attempt, r.status_code)
|
|
|
|
|
|
|
+ level = logging.WARNING if r.status_code in (400, 401, 403) else logging.INFO
|
|
|
|
|
+ _log.log(level, 'booking _msg_gql %s attempt=%d (after refresh) http=%d', operation_name, attempt, r.status_code)
|
|
|
await self._check_auth(r)
|
|
await self._check_auth(r)
|
|
|
r.raise_for_status()
|
|
r.raise_for_status()
|
|
|
raw = r.json()
|
|
raw = r.json()
|