"""Debug script to examine raw NHL API responses.""" import sys sys.path.insert(0, "/Users/michaelsimard/dev/services/project-kempe-backend") from nhlpy import NHLClient client = NHLClient() print("=" * 60) print("RAW API RESPONSE DEBUGGING") print("=" * 60) # Test teams endpoint print("\n1. Testing teams endpoint...") try: teams_data = client.teams.teams() print(f" Response type: {type(teams_data)}") if isinstance(teams_data, dict): print(f" Keys: {list(teams_data.keys())}") if "data" in teams_data: print(f" Number of teams in 'data': {len(teams_data['data'])}") if teams_data["data"]: print(f" First team keys: {list(teams_data['data'][0].keys())}") print(f" First team sample: {teams_data['data'][0]}") else: print(f" Response: {teams_data}") except Exception as e: print(f" ERROR: {e}") import traceback traceback.print_exc() # Test player game log print("\n2. Testing player game log (Sammy Blais ID: 8478104)...") try: game_log = client.stats.player_game_log( player_id="8478104", season_id="20242025", game_type=2 ) print(f" Response type: {type(game_log)}") if isinstance(game_log, dict): print(f" Keys: {list(game_log.keys())}") if "gameLog" in game_log: print(f" Number of games: {len(game_log['gameLog'])}") if game_log["gameLog"]: print(f" First game keys: {list(game_log['gameLog'][0].keys())}") else: print(f" Response: {game_log}") except Exception as e: print(f" ERROR: {e}") import traceback traceback.print_exc() print("\n" + "=" * 60)