logs-fix
All checks were successful
deploy / deploy (push) Successful in 1m36s

This commit is contained in:
Untone 2023-12-14 00:17:20 +03:00
parent 8fb2764bc1
commit b36a655090

View File

@ -33,31 +33,31 @@ async def check_auth(req) -> (bool, int | None):
async with session.post(AUTH_URL, json=gql, headers=headers) as response: async with session.post(AUTH_URL, json=gql, headers=headers) as response:
# Logging the GraphQL response # Logging the GraphQL response
response_text = await response.text() response_text = await response.text()
print(f"GraphQL Response: {response_text}") print(f"[services.auth] GraphQL Response: {response_text}")
if response.status == 200: if response.status == 200:
# Parsing JSON response # Parsing JSON response
data = await response.json() data = await response.json()
errors = data.get("errors") errors = data.get("errors")
if errors: if errors:
print(f"Auth connector errors: {errors}") print(f"[services.auth] errors: {errors}")
else: 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: if user_id:
# Logging the retrieved user ID # Logging the retrieved user ID
print(f"User ID retrieved: {user_id}") print(f"[services.auth] User ID retrieved: {user_id}")
return True, user_id return True, user_id
else: else:
# Logging when no user ID is found in the response # Logging when no user ID is found in the response
print("No user ID found in the response") print("[services.auth] No user ID found in the response")
else: else:
# Logging when the request to the authentication server fails # Logging when the request to the authentication server fails
print(f"Request failed with status: {response.status}") print(f"[services.auth] Request failed with status: {response.status}")
except Exception as e: except Exception as e:
# Handling and logging exceptions during authentication check # Handling and logging exceptions during authentication check
print(f"Exception during authentication check: {e}") print(f"[services.auth] {e}")
return False, None return False, None