diff --git a/main.py b/main.py index 440c7d3..5abe0b9 100644 --- a/main.py +++ b/main.py @@ -16,7 +16,6 @@ from services.rediscache import redis from settings import DEV_SERVER_PID_FILE_NAME, MODE, SENTRY_DSN -logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger('\t[main]\t') logger.setLevel(logging.DEBUG) @@ -54,4 +53,4 @@ async def shutdown(): app = Starlette(debug=True, on_startup=[start_up], on_shutdown=[shutdown]) -app.mount('/', GraphQL(schema, debug=True)) +app.mount('/', GraphQL(schema, graphiql=True, debug=True)) diff --git a/services/auth.py b/services/auth.py index f26b37a..72d589b 100644 --- a/services/auth.py +++ b/services/auth.py @@ -37,24 +37,15 @@ async def check_auth(req) -> str | None: try: # Asynchronous HTTP request to the authentication server async with ClientSession() as session: - async with session.post( - AUTH_URL, json=gql, headers=headers - ) as response: - print( - f'[services.auth] HTTP Response {response.status} {await response.text()}' - ) + async with session.post(AUTH_URL, json=gql, headers=headers) as response: + print(f'[services.auth] HTTP Response {response.status} {await response.text()}') if response.status == 200: data = await response.json() errors = data.get('errors') if errors: print(f'errors: {errors}') else: - user_id = ( - data.get('data', {}) - .get(query_name, {}) - .get('claims', {}) - .get('sub') - ) + user_id = data.get('data', {}).get(query_name, {}).get('claims', {}).get('sub') if user_id: print(f'[services.auth] got user_id: {user_id}') return user_id