Skip to content

Commit

Permalink
Fixed warning: "DeprecationWarning: datetime.datetime.utcnow() is dep…
Browse files Browse the repository at this point in the history
…recated and scheduled for removal in a future version".
  • Loading branch information
vmdocua committed Oct 18, 2023
1 parent bf8c90b commit 76f08d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion repromon_app/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ async def _web_oauth2_context(
detail="Unauthorized: Could not validate credentials",
headers={"WWW-Authenticate": "Bearer"},
)
logger.debug(f"_web_oauth2_context, token: {token}, strict={strict}")
logger.debug(f"_web_oauth2_context, token: ***, strict={strict}")
try:
mgr: SecurityManager = SecurityManager.instance()
username: str = mgr.get_username_by_token(token)
Expand All @@ -515,6 +515,7 @@ async def _web_oauth2_context(
return SecurityManager.instance().create_empty_context()
except BaseException as be:
if strict:
logging.error(f"Unauthorized exception occurred: {str(be)}", exc_info=True)

Check warning on line 518 in repromon_app/security.py

View check run for this annotation

Codecov / codecov/patch

repromon_app/security.py#L518

Added line #L518 was not covered by tests
credentials_exception.detail = f"Unauthorized: {str(be)}"
raise credentials_exception
return SecurityManager.instance().create_empty_context()
Expand Down

0 comments on commit 76f08d6

Please sign in to comment.