|
@@ -353,7 +353,7 @@ class _BookingClient(ServiceClientBase):
|
|
|
'Cookie': self._cookies,
|
|
'Cookie': self._cookies,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- 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) -> dict:
|
|
|
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 built per call so a retry after _ensure_refreshed uses the reloaded session
|
|
|
params = {
|
|
params = {
|
|
@@ -372,7 +372,7 @@ class _BookingClient(ServiceClientBase):
|
|
|
r = await self._request(_do_request, op=operation_name)
|
|
r = await self._request(_do_request, op=operation_name)
|
|
|
raw = r.json()
|
|
raw = r.json()
|
|
|
if raw.get('errors'):
|
|
if raw.get('errors'):
|
|
|
- _log.warning('booking _msg_gql %s attempt=%d gql errors: %s', operation_name, attempt, json.dumps(raw['errors']))
|
|
|
|
|
|
|
+ _log.warning('booking _msg_gql %s gql errors: %s', operation_name, json.dumps(raw['errors']))
|
|
|
msgs = ', '.join(e.get('message', '') for e in raw['errors'])
|
|
msgs = ', '.join(e.get('message', '') for e in raw['errors'])
|
|
|
raise RuntimeError(f'GraphQL error: {msgs}')
|
|
raise RuntimeError(f'GraphQL error: {msgs}')
|
|
|
return raw
|
|
return raw
|
|
@@ -576,7 +576,7 @@ class _BookingClient(ServiceClientBase):
|
|
|
}}
|
|
}}
|
|
|
_log.info('booking send_message res=%s idempotency=%s content_len=%d', reservation_id, idempotency, len(body))
|
|
_log.info('booking send_message res=%s idempotency=%s content_len=%d', reservation_id, idempotency, len(body))
|
|
|
try:
|
|
try:
|
|
|
- raw = await self._msg_gql('postFreeTextMessage', _POST_FREE_TEXT_MUTATION, payload, attempt=1)
|
|
|
|
|
|
|
+ raw = await self._msg_gql('postFreeTextMessage', _POST_FREE_TEXT_MUTATION, payload)
|
|
|
msg = ((raw.get('data') or {}).get('chatMessage') or {}).get('postFreeTextMessage') or {}
|
|
msg = ((raw.get('data') or {}).get('chatMessage') or {}).get('postFreeTextMessage') or {}
|
|
|
result = msg.get('message') or {}
|
|
result = msg.get('message') or {}
|
|
|
_log.info('booking send_message ok res=%s msg_id=%s created=%s', reservation_id, result.get('messageId'), result.get('created'))
|
|
_log.info('booking send_message ok res=%s msg_id=%s created=%s', reservation_id, result.get('messageId'), result.get('created'))
|
|
@@ -588,7 +588,7 @@ class _BookingClient(ServiceClientBase):
|
|
|
# re-priming 2FA — force the full refresh (SMS challenge included).
|
|
# re-priming 2FA — force the full refresh (SMS challenge included).
|
|
|
_log.warning('booking send_message ISE on attempt 1 res=%s idempotency=%s — re-triggering credential refresh', reservation_id, idempotency)
|
|
_log.warning('booking send_message ISE on attempt 1 res=%s idempotency=%s — re-triggering credential refresh', reservation_id, idempotency)
|
|
|
await self._ensure_refreshed(full=True)
|
|
await self._ensure_refreshed(full=True)
|
|
|
- raw = await self._msg_gql('postFreeTextMessage', _POST_FREE_TEXT_MUTATION, payload, attempt=2)
|
|
|
|
|
|
|
+ raw = await self._msg_gql('postFreeTextMessage', _POST_FREE_TEXT_MUTATION, payload)
|
|
|
msg = ((raw.get('data') or {}).get('chatMessage') or {}).get('postFreeTextMessage') or {}
|
|
msg = ((raw.get('data') or {}).get('chatMessage') or {}).get('postFreeTextMessage') or {}
|
|
|
result = msg.get('message') or {}
|
|
result = msg.get('message') or {}
|
|
|
_log.info('booking send_message ok (after 2FA retry) res=%s msg_id=%s created=%s', reservation_id, result.get('messageId'), result.get('created'))
|
|
_log.info('booking send_message ok (after 2FA retry) res=%s msg_id=%s created=%s', reservation_id, result.get('messageId'), result.get('created'))
|