nhl
A Python 3 API for NHL game and player stats.
-
class nhl.Conference(id: int, name: str, name_short: str, abbreviation: str)
NHL conference object.
-
abbreviation : str
Conference abbreviation
-
id : int
The NHL statsapi universal conference ID
-
name : str
Conference name
-
name_short : str
Conference name shortened
-
class nhl.Division(id: int, name: str, name_short: str, abbreviation: str)
NHL division object.
-
abbreviation : str
Division abbreviated name
-
id : int
The NHL statsapi universal division ID
-
name : str
Division name
-
name_short : str
Division short name
-
class nhl.Event(game_id: int, id: int, type: str, subtype: str, time: GameTime, location: Location, value: float, score: tuple[int, int], by_player_id: int, on_player_id: int, by_team_id: int, on_team_id: int)
NHL event object.
-
class nhl.Franchise(id: int, name: str)
NHL franchise object.
-
id : int
The NHL statsapi universal franchise ID
-
name : str
Franchise name
-
class nhl.GameTime(period: int, period_sec: int)
NHL game time object.
This object represents a unique time of the game. There are convenience properties to convert
the game time into convenient formats.
-
property min_sec : tuple[int, int]
Elapsed minutes and seconds of the game.
-
period : int
Game period. 1-3 for regulation. 4+ for overtime.
-
property period_min_sec : tuple[int, int]
Elapsed minutes and seconds of the period.
-
period_sec : int
Elapsed seconds of the period.
-
property period_str : str
Period number as string (i.e. “2nd”)
-
property sec : int
Elapsed seconds of the game.
-
class nhl.Location(x: int | None =
None
, y: int | None = None
)
NHL location object.
-
distance(other)
Measure distance between current location and another on-ice location.
- Parameters:
- other : Location
location to measure distance from
- Returns:
distance (ft)
- Return type:
float
-
x : int | None =
None
Rink position in ft along x-axis (length) [-100, 100]
-
y : int | None =
None
Rink position in ft along y-axis (breadth) [-42, 42]
-
class nhl.Official(id: int, name: str)
NHL official object.
-
property first_name : str
Official’s first name
-
id : int
The NHL statsapi universal official ID
-
property last_name : str
Official’s last name
-
name : str
Official’s full name
-
class nhl.Player(id: int, name: str, number: int, position: str, height: int, weight: int, shoots_catches: str, birth_date: date, birth_city: str, birth_country: str)
NHL player object.
-
property age : int
Current age in years
-
birth_city : str
Player’s birth city
-
birth_country : str
Player’s birth country
-
birth_date : date
Player’s birth date
-
property first_name : str
Player’s first name
-
height : int
Player’s height in total inches
-
property height_ft_in : tuple[int, int]
Height in feet and inches (height
// 12, height
% 12)
-
id : int
The NHL statsapi universal player ID
-
property last_name : str
Player’s last name
-
name : str
Player’s full name
-
number : int
Player’s primary number
-
position : str
Player’s primary position (“LW”, “C”, “RW”, “D”, “G”)
-
shoots_catches : str
Indication of whether the player shoots (skater)/catches (goalie) “L” or “R”
-
weight : int
Player’s weight in lbs
-
class nhl.Shift(game_id: int, player_id: int, shift_id: int, on: GameTime, off: GameTime)
NHL shift object.
-
game_id : int
NHL statsapi unique game ID
-
length : int
Shift length in seconds
-
off : GameTime
Shift end game time
-
on : GameTime
Shift start game time
-
player_id : int
NHL statsapi unique player ID
-
shift_id : int
Shift number for specified game
-
class nhl.Team(id: int, location: str, name: str, abbreviation: str, first_year: int, division: Division, conference: Conference, franchise: Franchise)
NHL team object.
-
abbreviation : str
Team’s name abbreviated
-
conference : Conference
The NHL conference the team is in
-
division : Division
The NHL division the team is in
-
first_year : int
First year of play
-
franchise : Franchise
The NHL franchise the team belongs to
-
property full_name : str
Team’s full name
-
id : int
The NHL statsapi universal team ID
-
location : str
Team’s location
-
name : str
Team’s name
-
class nhl.Venue(id: int, name: str)
NHL venue object.
-
id : int
The NHL statsapi universal venue ID
-
name : str
Venue name
Last update:
May 23, 2022