From bf8c90bb61007780e4d4cb6ae74d3cd1a11a60e6 Mon Sep 17 00:00:00 2001 From: Vadim Melnik Date: Thu, 19 Oct 2023 02:15:09 +0300 Subject: [PATCH] Fixed warning: "DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version". --- .github/workflows/pytest.yml | 2 +- repromon_app/security.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index a5ceead..5f16739 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -57,7 +57,7 @@ jobs: - name: Run pytest run: | - poetry run pytest --cov=. --cov-report=xml + poetry run pytest --cov=. --cov-report=xml -s shell: bash - name: Upload coverage reports to Codecov diff --git a/repromon_app/security.py b/repromon_app/security.py index 4c444ee..c1bb3f7 100644 --- a/repromon_app/security.py +++ b/repromon_app/security.py @@ -169,7 +169,7 @@ def create_access_token(self, username: str, expire_sec: int = -1) -> str: datetime.now(timezone.utc) + timedelta(seconds=expire_sec) data = { "sub": username, - "exp": expire + "exp": int(expire.timestamp()) } logger.debug(f"data={str(data)}") token: str = jwt.encode(data,