Save session data to file
(data, user_id: str)
| 1054 | |
| 1055 | |
| 1056 | def save_session_data(data, user_id: str): |
| 1057 | """Save session data to file""" |
| 1058 | try: |
| 1059 | session_file = get_session_file_path(user_id) |
| 1060 | os.makedirs(os.path.dirname(session_file), exist_ok=True) |
| 1061 | with open(session_file, 'w', encoding='utf-8') as f: |
| 1062 | json.dump(data, f, ensure_ascii=False, indent=2) |
| 1063 | except Exception as e: |
| 1064 | logger.info(f'Failed to save session data: {e}') |
| 1065 | |
| 1066 | |
| 1067 | def load_session_data(user_id: str): |
no test coverage detected