Skip to main content

NHL — additional Python functions — NHL Web API

nhl_scoreboard​

nhl_scoreboard(date: 'Optional[str]' = None, team: 'Optional[str]' = None, *, return_parsed: 'bool' = True, return_as_pandas: 'bool' = False, **kwargs) -> 'Dict'

In-game scoreboard payload (renamed from nhl_web_scoreboard).

Picks among three mutually-exclusive NHL api-web forms (kept hand-written because the URL-builder codegen can't represent the 3-way branch):

  • GET /v1/scoreboard/{team}/now -- team-scoped now (when team set),
  • GET /v1/scoreboard/{date} -- league-wide on a date,
  • GET /v1/scoreboard/now -- league-wide now (both args None).

Parameters

ParameterTypeDefaultDescription
dateOptional[str]NoneYYYY-MM-DD; None -> /now. Mutually exclusive with team.
teamOptional[str]None3-letter abbreviation; takes precedence over date.
return_parsedboolTruedispatch the raw payload through parse_nhl_web_scoreboard.
return_as_pandasboolFalsewith return_parsed, return pandas instead of polars.

Returns

A polars/pandas DataFrame by default; the raw JSON Dict when return_parsed=False.

col_nametypedescription
scoreboard_dateStringCalendar date (YYYY-MM-DD) for which this scoreboard snapshot was retrieved from the NHL api-web feed.
idInt64Unique player identifier.
seasonInt64Season year (echoed from arg).
game_typeInt64Game type the row belongs to.
game_dateStringGame date.
game_center_linkStringLink to the NHL game center page.
start_time_utcStringScheduled start time in UTC.
eastern_utc_offsetStringEastern time UTC offset.
venue_utc_offsetStringVenue UTC offset.
tv_broadcastsStringNested list of TV broadcast details.
game_stateStringGame state (e.g., FINAL, LIVE).
game_schedule_stateStringSchedule state of the game.
tickets_linkStringURL to the English-language ticket purchase page for the game, as provided by the NHL api-web scoreboard.
tickets_link_frStringURL to the French-language ticket purchase page for the game, as provided by the NHL api-web scoreboard.
periodFloat64Period number.
three_min_recapStringLink to the three-minute recap.
three_min_recap_frStringLink to the French three-minute recap.
venue_defaultStringVenue name (default language).
away_team_idInt64Away team identifier.
away_team_name_defaultStringFull English-language team name for the away team, as returned by the NHL api-web scoreboard feed.
away_team_name_frStringFull French-language team name for the away team, as returned by the NHL api-web scoreboard feed.
away_team_common_name_defaultStringAway team common name (default language).
away_team_place_name_with_preposition_defaultStringAway team place name with preposition (default).
away_team_place_name_with_preposition_frStringAway team place name with preposition (French).
away_team_abbrevStringAway team abbreviation.
away_team_scoreFloat64Away team final score.
away_team_logoStringURL to the away team logo.
home_team_idInt64Home team identifier.
home_team_name_defaultStringFull English-language team name for the home team, as returned by the NHL api-web scoreboard feed.
home_team_name_frStringFull French-language team name for the home team, as returned by the NHL api-web scoreboard feed.
home_team_common_name_defaultStringHome team common name (default language).
home_team_place_name_with_preposition_defaultStringHome team place name with preposition (default).
home_team_place_name_with_preposition_frStringHome team place name with preposition (French).
home_team_abbrevStringHome team abbreviation.
home_team_scoreFloat64Home team final score.
home_team_logoStringURL to the home team logo.
period_descriptor_numberFloat64Period number.
period_descriptor_period_typeStringPeriod type (e.g., REG, OT).
period_descriptor_max_regulation_periodsFloat64Maximum number of regulation periods.
series_status_roundInt64Playoff round number for this game's series (1 = first round, 2 = second round, etc.).
series_status_series_abbrevStringShort abbreviation string identifying the specific playoff series matchup (e.g., 'A1' for a particular bracket slot).
series_status_gameInt64Game number within the current playoff series (e.g., 1 through 7) for the game represented in this scoreboard row.
series_status_top_seed_team_abbrevStringThree-letter abbreviation for the higher-seeded team in the playoff series context embedded in the scoreboard game entry.
series_status_top_seed_winsInt64Number of wins accumulated by the higher-seeded team in the current playoff series as of this scoreboard snapshot.
series_status_bottom_seed_team_abbrevStringThree-letter abbreviation for the lower-seeded team in the playoff series context embedded in the scoreboard game entry.
series_status_bottom_seed_winsInt64Number of wins accumulated by the lower-seeded team in the current playoff series as of this scoreboard snapshot.
period_descriptor_ot_periodsFloat64Number of overtime periods played when the game extended beyond regulation, as reported in the scoreboard period descriptor.
away_team_recordString
home_team_recordString
away_team_common_name_frStringAway team common name (French).
home_team_common_name_frStringHome team common name (French).
away_team_sogFloat64Away team shots on goal.
home_team_sogFloat64Home team shots on goal.
clock_time_remainingString
clock_seconds_remainingFloat64
clock_runningBoolean
clock_in_intermissionBoolean

Raises

ExceptionDescription
NoDataErrorApi-web answered 404.
ValueErrorApi-web answered 400 / 422 -- the request is wrong.
AssetFetchErrorAny other non-2xx or a connection failure after retries, or a 2xx whose body is empty (not 204/205) or not JSON.

Example

nhl_scoreboard(date="2024-03-01")