fix: replace datetime.UTC with timezone.utc for Python 3.10 compatibility

datetime.UTC was introduced in Python 3.11. Users on 3.10 get an ImportError.
Also lower ruff/mypy target-version from py313 to py310 to match minimum supported version.
This commit is contained in:
Pouzor
2026-03-09 22:01:32 +01:00
parent 99b40fa9e9
commit 6ae7f7768f
6 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
from datetime import UTC, datetime, timedelta
from datetime import datetime, timedelta, timezone
from jose import JWTError, jwt
from passlib.context import CryptContext
@@ -17,7 +17,7 @@ def hash_password(password: str) -> str:
def create_access_token(subject: str) -> str:
expire = datetime.now(UTC) + timedelta(minutes=settings.access_token_expire_minutes)
expire = datetime.now(timezone.utc) + timedelta(minutes=settings.access_token_expire_minutes)
payload = {"sub": subject, "exp": expire}
return str(jwt.encode(payload, settings.secret_key, algorithm=settings.algorithm))