Skip to content

Commit

Permalink
Fixed mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Oct 16, 2023
1 parent 07e8c6e commit d7fc65f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions backend/src/services/graph_access/graph_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d7fc65f

Please sign in to comment.