Skip to content

Commit

Permalink
Fixed wraning: "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 65d7b74 commit f097586
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions repromon_app/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import hashlib
import logging
import uuid
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import Annotated

from fastapi import Depends, HTTPException, Request, status
Expand Down Expand Up @@ -166,7 +166,7 @@ def create_access_token(self, username: str, expire_sec: int = -1) -> str:
expire_sec = app_settings().TOKEN_EXPIRE_SEC
if username and len(username) > 0:
expire: datetime.datetime = \
datetime.utcnow() + timedelta(seconds=expire_sec)
datetime.now(timezone.utc) + timedelta(seconds=expire_sec)
data = {
"sub": username,
"exp": expire
Expand Down

0 comments on commit f097586

Please sign in to comment.