Skip to content

Commit

Permalink
Adjusted according to review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Sep 25, 2023
1 parent b266970 commit 8068aca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 5 additions & 2 deletions backend/src/backend/primary/routers/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import datetime
import logging

import httpx
import starsessions
from starlette.responses import StreamingResponse
from fastapi import APIRouter, HTTPException, Request, status, Depends, Query
Expand Down Expand Up @@ -74,8 +75,10 @@ async def logged_in_user(
user_info.avatar_b64str = avatar_b64str
if graph_user_info is not None:
user_info.display_name = graph_user_info.get("displayName", None)
except Exception as e:
print("Error while fetching user avatar and info from Microsoft Graph API:\n", e)
except httpx.HTTPError as e:
print("Error while fetching user avatar and info from Microsoft Graph API (HTTP error):\n", e)
except httpx.InvalidURL as e:
print("Error while fetching user avatar and info from Microsoft Graph API (Invalid URL):\n", e)

return user_info

Expand Down
10 changes: 5 additions & 5 deletions backend/src/services/utils/authenticated_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def __init__(
) -> None:
self._user_id = user_id
self._username = username
self._graph_access_token = access_tokens.get("graph_access_token", None)
self._sumo_access_token = access_tokens.get("sumo_access_token", None)
self._smda_access_token = access_tokens.get("smda_access_token", None)
self._pdm_access_token = access_tokens.get("pdm_access_token", None)
self._ssdl_access_token = access_tokens.get("ssdl_access_token", None)
self._graph_access_token = access_tokens.get("graph_access_token")
self._sumo_access_token = access_tokens.get("sumo_access_token")
self._smda_access_token = access_tokens.get("smda_access_token")
self._pdm_access_token = access_tokens.get("pdm_access_token")
self._ssdl_access_token = access_tokens.get("ssdl_access_token")

def __hash__(self) -> int:
return hash(self._user_id)
Expand Down

0 comments on commit 8068aca

Please sign in to comment.