code styling
This commit is contained in:
parent
ddf5f12409
commit
a31c80465a
@ -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)})
|
||||
|
||||
|
10
test/main.py
10
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('../')
|
||||
|
Loading…
Reference in New Issue
Block a user