cra / utils.py
mudejayaprakash
Deploy auth circular dependency fix
5a2b00f
raw
history blame contribute delete
592 Bytes
import json
import os
from datetime import datetime
def save_session(user_id: str, session_file: str = "session.json"):
"""
Save the current user session to a file.
Args:
user_id: The ID of the authenticated user.
session_file: The path to the session file.
"""
try:
session_data = {
"user_id": user_id,
"last_login": datetime.now().isoformat()
}
with open(session_file, 'w') as f:
json.dump(session_data, f, indent=2)
except Exception as e:
print(f"Error saving session: {e}")