From a31c80465afa198a9a0bfdb2bca46fd595676ca0 Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Tue, 8 Apr 2025 14:05:54 +0200 Subject: [PATCH] code styling --- app/main.py | 9 ++------- test/main.py | 10 +++++----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/main.py b/app/main.py index b31c5ec..9f30ba0 100644 --- a/app/main.py +++ b/app/main.py @@ -19,12 +19,7 @@ from jose.constants import ALGORITHMS from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from starlette.middleware.cors import CORSMiddleware -from starlette.responses import StreamingResponse, JSONResponse as JSONr, HTMLResponse as HTMLr, Response, \ - RedirectResponse - -# add relative path to use packages as they were in the app/ dir -sys.path.append('../') -sys.path.append('../app') +from starlette.responses import StreamingResponse, JSONResponse as JSONr, HTMLResponse as HTMLr, Response, RedirectResponse from orm import Origin, Lease, init as db_init, migrate, Instance, Site @@ -403,7 +398,7 @@ async def auth_v1_token(request: Request): jwt_encode_key, jwt_decode_key = default_instance.get_jwt_encode_key(), default_instance.get_jwt_decode_key() try: - payload = jwt.decode(token=j.get('auth_code'), key=jwt_decode_key, algorithms=[ALGORITHMS.RS256]) + payload = jwt.decode(token=j.get('auth_code'), key=jwt_decode_key, algorithms=ALGORITHMS.RS256) except JWTError as e: return JSONr(status_code=400, content={'status': 400, 'title': 'invalid token', 'detail': str(e)}) diff --git a/test/main.py b/test/main.py index 6442148..a2adc51 100644 --- a/test/main.py +++ b/test/main.py @@ -1,16 +1,16 @@ -from os import getenv as env +import sys from base64 import b64encode as b64enc -from hashlib import sha256 from calendar import timegm from datetime import datetime, UTC -from uuid import UUID, uuid4 +from hashlib import sha256 +from os import getenv as env +from uuid import uuid4, UUID from dateutil.relativedelta import relativedelta from jose import jwt from jose.constants import ALGORITHMS -from starlette.testclient import TestClient from sqlalchemy import create_engine -import sys +from starlette.testclient import TestClient # add relative path to use packages as they were in the app/ dir sys.path.append('../')