Răsfoiți Sursa

Log GQL errors returned by Airbnb query responses

getDLSHostCalendar (and other _gql-routed queries) can return data: null
with an errors payload that isn't auth-shaped, which previously surfaced
only as a generic empty/priceless calendar warning with no indication
of why.
ZiB 5 zile în urmă
părinte
comite
56376af978
1 a modificat fișierele cu 4 adăugiri și 1 ștergeri
  1. 4 1
      room_cal/service_api/_airbnb.py

+ 4 - 1
room_cal/service_api/_airbnb.py

@@ -231,7 +231,10 @@ class _AirbnbClient(ServiceClientBase):
     async def _attempt() -> httpx.Response:
       return await self._http.get(url, params=params, headers=self._headers(referer))
     r = await self._request(_attempt, op=op)
-    return r.json()
+    body = r.json()
+    if errors := body.get('errors'):
+      _log.warning('Airbnb: %s returned GQL errors (data=%r): %r', op, body.get('data'), errors)
+    return body
 
   async def _mutate(self, op: str, h: str, variables: dict, referer: str) -> dict:
     url = f'{_BASE}/{op}/{h}?operationName={op}&locale=en&currency=USD'