Files
gh-christianlouis-leagueledger/debug_session.py
T
Christian Krakau-Louis 0de2eb5830 Implement user authentication and management system with FastAPI
- Added authentication routes for login, registration, password reset, and account deletion in `auth.py`.
- Implemented user profile management, including updating user information and changing passwords.
- Created dashboard views to display user-specific information and recent activity in `dashboard.py`.
- Developed leaderboard views to show team rankings and points in `leaderboard.py`.
- Added QR code generation and redemption functionality in `qr.py` and `redeem.py`.
- Implemented team management features, allowing users to create and join teams in `teams.py`.
- Introduced session debugging utility to assist with session-related issues in `debug_session.py`.
- Configured Docker Compose for MySQL database and FastAPI application with environment variables.
- Updated requirements.txt to include necessary dependencies for the application.
2025-04-11 17:46:59 +02:00

31 lines
997 B
Python

#!/usr/bin/env python3
"""
Utility module to help debug session problems.
"""
from fastapi import Request
def print_session_debug(request: Request):
"""Print debug information about the request session."""
print("\n=== SESSION DEBUG INFO ===")
print(f"Request URL: {request.url}")
print(f"Session in scope: {'session' in request.scope}")
if 'session' in request.scope:
print("Session contents:")
try:
for key, value in request.session.items():
print(f" {key}: {value}")
except Exception as e:
print(f"Error accessing session items: {e}")
else:
print("No session found in request scope")
print("Headers:")
for name, value in request.headers.items():
if name.lower() in ('cookie', 'set-cookie'):
print(f" {name}: [REDACTED]") # Don't print actual cookie values
else:
print(f" {name}: {value}")
print("=========================\n")