From 4b1068e02fedea5f54d610b129e067d758cf92f0 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 18 May 2024 23:33:26 +0700 Subject: [PATCH] Replace deprecated method datetime.utcnow() --- gns3server/services/authentication.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/services/authentication.py b/gns3server/services/authentication.py index 5613d0df..9dbf1616 100644 --- a/gns3server/services/authentication.py +++ b/gns3server/services/authentication.py @@ -16,7 +16,7 @@ from jose import JWTError, jwt -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone import bcrypt from typing import Optional @@ -48,7 +48,7 @@ class AuthService: if not expires_in: expires_in = Config.instance().settings.Controller.jwt_access_token_expire_minutes - expire = datetime.utcnow() + timedelta(minutes=expires_in) + expire = datetime.now(timezone.utc) + timedelta(minutes=expires_in) to_encode = {"sub": username, "exp": expire} if secret_key is None: secret_key = Config.instance().settings.Controller.jwt_secret_key