From 88dc74414ec6172dd628a17574bf9db574d10bfd Mon Sep 17 00:00:00 2001 From: qiangyanwen <508737091@qq.com> Date: Tue, 6 Dec 2022 11:19:47 +0800 Subject: [PATCH] changecase --- pyproject.toml | 1 + utils/jwt_token.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bec88a5..314b49d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ python-multipart = "^0.0.5" uvicorn = "^0.17.6" loguru = "^0.6.0" alembic = "^1.7.7" +pyyaml = "^6.0" [tool.poetry.dev-dependencies] diff --git a/utils/jwt_token.py b/utils/jwt_token.py index bd30e79..3fb92ed 100644 --- a/utils/jwt_token.py +++ b/utils/jwt_token.py @@ -47,9 +47,9 @@ def parse_token(token: str = Depends(oauth_scame)): try: jwt_data = jwt.decode(token, settings.ACCESS.SECRET_KEY, algorithms=settings.ACCESS.ALGORITHM) - id = jwt_data.get("id") - if id is None or id == "": + user_id = jwt_data.get("id") + if user_id is None or user_id == "": raise token_exception except JWTError: raise token_exception - return id \ No newline at end of file + return user_id