nhl.statsapi

A module containing functions for querying the NHL statsapi REST API https://statsapi.web.nhl.com/api/v1.

nhl.statsapi.conference(id: int) Conference

Fetches a single conference by its ID.

Parameters:
id: int

The NHL statsapi conference ID.

Returns:

A Conference object.

nhl.statsapi.conferences() list[Conference]

Fetches all conferences.

Returns:

A list of Conference objects.

nhl.statsapi.division(id: int) Division

Fetches a single division by its ID.

Parameters:
id: int

The NHL statsapi division ID.

Returns:

A Division object.

nhl.statsapi.divisions() list[Division]

Fetches all divisions.

Returns:

A list of Division objects.

nhl.statsapi.franchise(id: int) Franchise

Fetches a single franchise by its ID.

Parameters:
id: int

The NHL statsapi franchise ID.

Returns:

A Franchise object.

nhl.statsapi.franchises() list[Franchise]

Fetches all franchises.

Returns:

A list of Franchise objects.

nhl.statsapi.player(id: int) Player

Fetches a single player by its ID.

Parameters:
id: int

The NHL statsapi player ID.

Returns:

A Player object.

nhl.statsapi.players(ids: Sequence[int]) list[Player]

Fetches multiple players by their IDs.

Returns:

A list of Player objects.

nhl.statsapi.shifts(game_id: int, player_id: int) list[Shift]

Fetches all shifts of a player of a given game.

Parameters:
game_id: int

The NHL statsapi game ID.

player_id: int

The NHL statsapi player ID.

Returns:

A list of Shift objects.

Raises:

ValueError – If the player is not found in the game.

nhl.statsapi.team(id: int) Team

Fetches a single team by its ID.

Parameters:
id: int

The NHL statsapi team ID.

Returns:

A Team object.

nhl.statsapi.teams() list[Team]

Fetches all teams.

Returns:

A list of Team objects.

nhl.statsapi.venue(id: int) Venue

Fetches a single venue by its ID.

Parameters:
id: int

The NHL statsapi venue ID.

Returns:

A Venue object.

nhl.statsapi.venues() list[Venue]

Fetches all venues.

Returns:

A list of Venue objects.


Last update: May 23, 2022