From d7fc65f207ce102b852beb41b06de221481edb6f Mon Sep 17 00:00:00 2001 From: Ruben Thoms Date: Mon, 16 Oct 2023 17:38:12 +0200 Subject: [PATCH] Fixed mypy issues --- backend/src/services/graph_access/graph_access.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/src/services/graph_access/graph_access.py b/backend/src/services/graph_access/graph_access.py index d1658d38d..53f8d5ee0 100644 --- a/backend/src/services/graph_access/graph_access.py +++ b/backend/src/services/graph_access/graph_access.py @@ -21,27 +21,24 @@ async def _request(self, url: str) -> httpx.Response: return response async def get_user_profile_photo(self, user_id: str) -> str | None: - print("entering get_user_profile_photo") request_url = f"https://graph.microsoft.com/v1.0/me/photo/$value" + if user_id != "me": request_url = f"https://graph.microsoft.com/v1.0/users/{user_id}/photo/$value" - print(f"Trying to fetch user photo from: {request_url}") response = await self._request(request_url) if response.status_code == 200: return base64.b64encode(response.content).decode("utf-8") else: - print(f"Failed ({response.status_code}): {response.content}") return None - async def get_user_info(self, user_id) -> Mapping[str, str] | None: - print("entering get_user_info") + async def get_user_info(self, user_id: str) -> Mapping[str, str] | None: request_url = f"https://graph.microsoft.com/v1.0/me" + if user_id != "me": request_url = f"https://graph.microsoft.com/v1.0/users/{user_id}" - print(f"Trying to fetch user info from: {request_url}") response = await self._request(request_url) if response.status_code == 200: