(20250116) Handling Gmail profile fetching.

This commit is contained in:
2025-01-16 16:50:44 +05:30
parent 0c1b8e1b0f
commit f918dace2b
@@ -170,6 +170,15 @@ class AsyncGMailClient(AsyncGoogleBase):
gmail_api_response.data["displayName"] = None
gmail_api_response.data["displayPictureUrl"] = None
# If the call failed:
else:
self._printer(
gmail_api_response.action,
gmail_api_response.method,
gmail_api_response.httpCode,
)
return gmail_api_response
# Make the People API call:
if not self._debug_only_errors: self._printer("Getting User Profile.")
people_api_response = await self.get(
@@ -188,6 +197,13 @@ class AsyncGMailClient(AsyncGoogleBase):
if item["metadata"]["primary"]:
gmail_api_response.data["displayPictureUrl"] = item.get("url")
# If the call failed:
else: self._printer(
people_api_response.action,
people_api_response.method,
people_api_response.httpCode,
)
# Done here:
return gmail_api_response