(20250116) Handling Gmail profile fetching.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user