From 1369a891eaa7901511c0e8e486e453770b62a945 Mon Sep 17 00:00:00 2001 From: Vadim Melnik Date: Thu, 19 Oct 2023 00:27:49 +0300 Subject: [PATCH] Fixed wraning: "DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version". --- repromon_app/security.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repromon_app/security.py b/repromon_app/security.py index 4c444ee..49a01af 100644 --- a/repromon_app/security.py +++ b/repromon_app/security.py @@ -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.now(timezone.utc) + timedelta(seconds=expire_sec) + datetime.now(timezone.utc).replace(tzinfo=None) + timedelta(seconds=expire_sec) data = { "sub": username, "exp": expire