API Reference
Full auto-generated documentation for all SlaPyShot classes and methods.
NHLClient
slapyshot.client.NHLClient
Main client for interacting with the SportRadar NHL API.
Loads the API key from the SPORTRADAR_API_KEY environment variable. Enforces a 1 second delay between requests to respect free tier rate limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
Your SportRadar API key. If not provided, loads from the SPORTRADAR_API_KEY environment variable or .env file. |
None
|
access_level
|
str
|
Either "trial" (default, free tier) or "production". |
'trial'
|
rate_limit_delay
|
float
|
Seconds to wait between requests. Defaults to 1.0 to stay within the free tier limit of 1 call/second. |
1.0
|
Example
Free tier (default)
client = NHLClient()
Production tier
client = NHLClient(access_level="production")
client.teams.get_all_teams()
TeamsEndpoint
slapyshot.endpoints.teams.TeamsEndpoint
Endpoints related to NHL teams and rosters.
Access via the NHLClient
client.teams.get_all_teams() client.teams.get_team_profile(team_id="4416091c-0f24-11e2-8525-18a905767e44") client.teams.get_team_roster(team_id="4416091c-0f24-11e2-8525-18a905767e44")
get_all_teams()
Get a list of all NHL teams.
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per team with columns: id, name, market, alias, founded, conference_id, conference_name, division_id, division_name |
Example
teams = client.teams.get_all_teams() print(teams) print(teams["name"])
get_team_profile(team_id)
Get a profile for a specific team including venue and coach info.
Note: Returns the same data as get_team_roster() — use whichever name makes your code more readable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_id
|
str
|
The SportRadar UUID for the team (e.g. "4416091c-0f24-11e2-8525-18a905767e44" for Minnesota Wild). Use get_all_teams() to find team IDs. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per player on the roster with columns: id, full_name, first_name, last_name, jersey_number, primary_position, birth_date, birth_city, birth_country, height, weight, shoots_catches, team_id, team_name |
Example
profile = client.teams.get_team_profile("4416091c-0f24-11e2-8525-18a905767e44") print(profile.select(["full_name", "primary_position"]))
get_team_roster(team_id)
Get the current roster for a specific team.
Note: Returns the same data as get_team_profile() — use whichever name makes your code more readable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_id
|
str
|
The SportRadar UUID for the team. Use get_all_teams() to find team IDs. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per player on the roster with columns: id, full_name, first_name, last_name, jersey_number, primary_position, birth_date, birth_city, birth_country, height, weight, shoots_catches, team_id, team_name |
Example
roster = client.teams.get_team_roster("4416091c-0f24-11e2-8525-18a905767e44") print(roster.filter(pl.col("primary_position") == "G"))
ScheduleEndpoint
slapyshot.endpoints.schedule.ScheduleEndpoint
Endpoints related to NHL game schedules.
Access via the NHLClient
client.schedule.get_daily_schedule(2026, 3, 23) client.schedule.get_season_schedule(2025, "REG")
get_daily_schedule(year, month, day)
Get the schedule for a specific date.
Returns all games taking place on the given day including venue, broadcast, and team info.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
Four digit year (e.g. 2026) |
required |
month
|
int
|
Month as an integer (e.g. 3) |
required |
day
|
int
|
Day as an integer (e.g. 23) |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per game with columns: id, status, scheduled, home_team_id, home_team_name, home_team_alias, away_team_id, away_team_name, away_team_alias, venue_id, venue_name |
Example
schedule = client.schedule.get_daily_schedule(2026, 3, 23) print(schedule.select(["home_team_name", "away_team_name", "status"]))
get_season_schedule(season_year, season_type)
Get the full schedule for an entire season.
Note: season_year is the starting year of the season. For example, the 2025-26 season uses season_year=2025.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_year
|
int
|
The starting year of the season (e.g. 2025 for 2025-26) |
required |
season_type
|
str
|
One of 'PRE' (preseason), 'REG' (regular season), or 'PST' (postseason/playoffs) |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per game with columns: id, status, scheduled, home_team_id, home_team_name, home_team_alias, away_team_id, away_team_name, away_team_alias, venue_id, venue_name |
Example
schedule = client.schedule.get_season_schedule(2025, "REG") print(f"Total games: {len(schedule)}") print(schedule.filter(pl.col("home_team_name") == "Avalanche"))
Raises:
| Type | Description |
|---|---|
ValueError
|
If season_type is not one of PRE, REG, or PST. |
GamesEndpoint
slapyshot.endpoints.games.GamesEndpoint
Endpoints related to NHL live and historical game data.
All endpoints require a game_id. Get game IDs from the schedule endpoints: >>> schedule = client.schedule.get_daily_schedule(2026, 3, 23) >>> game_id = schedule["id"][0]
Then use it here
client.games.get_game_summary(game_id) client.games.get_game_boxscore(game_id) client.games.get_game_play_by_play(game_id)
get_game_boxscore(game_id)
Get the boxscore for a specific game.
Returns one row per period with home and away scores. Lighter than get_game_summary() — use this for scoreboards and high-level score tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
str
|
The SportRadar UUID for the game. Get this from client.schedule.get_daily_schedule() or client.schedule.get_season_schedule(). |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per period with columns: game_id, period_number, period_type, home_team_id, home_team_name, home_points, away_team_id, away_team_name, away_points |
Example
boxscore = client.games.get_game_boxscore(game_id) print(boxscore.select(["period_number", "home_points", "away_points"]))
get_game_play_by_play(game_id)
Get play-by-play data for a specific game.
Returns one row per event with detailed information on every possession, faceoff, shot, and goal in the game.
Note: This is the heaviest endpoint — use sparingly on the free tier as it counts as one API call but returns a large payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
str
|
The SportRadar UUID for the game. Get this from client.schedule.get_daily_schedule() or client.schedule.get_season_schedule(). |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per event with columns: game_id, period_number, event_id, event_type, clock, description, player_id, player_name, team_id |
Example
pbp = client.games.get_game_play_by_play(game_id) print(pbp.filter(pl.col("event_type") == "goal"))
get_game_summary(game_id)
Get a rich summary for a specific game including detailed stats.
Returns one row per player with their individual game statistics. Use this when you want richer data beyond just the score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
str
|
The SportRadar UUID for the game. Get this from client.schedule.get_daily_schedule() or client.schedule.get_season_schedule(). |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per player with columns: game_id, team_id, team_name, player_id, full_name, position, goals, assists, points, plus_minus, shots, penalty_minutes, time_on_ice |
Example
schedule = client.schedule.get_daily_schedule(2026, 3, 23) game_id = schedule["id"][0] summary = client.games.get_game_summary(game_id) print(summary.sort("points", descending=True))
PlayersEndpoint
slapyshot.endpoints.players.PlayersEndpoint
Endpoints related to NHL player stats and profiles.
Player IDs are found via the team roster. The recommended workflow is: 1. Get team ID: client.teams.get_all_teams() 2. Get player ID: client.teams.get_team_roster(team_id) 3. Get player: client.players.get_player_profile(player_id)
Example
teams = client.teams.get_all_teams() team_id = teams["id"][0] roster = client.teams.get_team_roster(team_id) player_id = roster["id"][0] client.players.get_player_profile(player_id)
get_player_profile(player_id)
Get full profile and career stats for a specific player.
Returns one row per season with biographical info and stats. Season entries are sorted with the most recent team first, so you can reliably infer the player's current team from row 0.
Note: Player IDs never change once assigned, so they are safe to store and reuse across sessions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
player_id
|
str
|
The SportRadar UUID for the player. Find player IDs via client.teams.get_team_roster(). |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per season with columns: player_id, full_name, primary_position, season_year, season_type, team_id, team_name, games_played, goals, assists, points, plus_minus, shots, penalty_minutes |
Example
profile = client.players.get_player_profile( ... "433de553-0f24-11e2-8525-18a905767e44" # Sidney Crosby ... ) print(profile.filter(pl.col("season_type") == "REG")) print(profile.sort("season_year", descending=True).head(1))
get_player_season_stats(season_year, season_type, team_id)
Get full season statistics for all players on a specific team.
Returns one row per player. Use this for leaderboards or comparing players across a team.
Note: season_year is the starting year of the season. For example, the 2025-26 season uses season_year=2025.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_year
|
int
|
The starting year of the season (e.g. 2025 for 2025-26) |
required |
season_type
|
str
|
One of 'REG' (regular season) or 'PST' (postseason). Note: 'PRE' (preseason) is not supported for stats. |
required |
team_id
|
str
|
The SportRadar UUID for the team. Find team IDs via client.teams.get_all_teams(). |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: One row per player with columns: team_id, team_name, player_id, full_name, primary_position, games_played, goals, assists, points, plus_minus, shots, penalty_minutes |
Example
stats = client.players.get_player_season_stats( ... season_year=2025, ... season_type="REG", ... team_id="4415ce44-0f24-11e2-8525-18a905767e44" # Colorado Avalanche ... ) print(stats.sort("points", descending=True)) print(stats.filter(pl.col("goals") >= 20))
Raises:
| Type | Description |
|---|---|
ValueError
|
If season_type is not one of PRE, REG, or PST. |