Install nhlapip with pip:
pip install nhlapip
The API is exposed via endpoint-based classes. See below for a full list of endpoints. Some quick examples:
# Player Data for Joe Sakic
from nhlapip.player import Player
sakic = Player('8451101')
print(sakic.get_data())
# Player's All Seasons Statistics
print(sakic.get_stats_allseasons())
# All Teams' Rosters
from nhlapip.team import Team
all_teams = Team()
print(all_teams.get_roster())
Many usage examples can be found in the Pandas showcase that shows data retrieval for many endpoints.
A very simple CLI is also available. This is still in active development. Some examples:
echo '\n\Get data nhlapip for 1 player:\n'
nhlapip Player 8451101
echo '\n\nGet data for 2 Teams :\n'
nhlapip Team 1 2
Many usage examples can be found in the CLI showcase that shows CLI data retrieval for many endpoints.
-
Teams
- Team Metadata
Team().get_data()
- Team Rosters
Team().get_roster()
- Team Schedules
Team().get_schedule_next()
,Team().get_schedule_previous()
- Team Stats
Team().get_stats()
- Team Metadata
-
People (
Player
)- Players metadata
Player.get_data()
- Players all season stats
Player.get_stats_allseasons()
- Players metadata
-
Games (
Game
)- Games content
Game.get_content()
- Games full live feed
Game.get_feed()
- Games box score info
Game.get_boxscore()
- Games line score info
Game.get_linescore()
- Games content
-
Tournaments
- Playoffs
Tournament("playoffs")
- Olympics
Tournament("olympics")
- World Cups
Tournament("worldcup")
- Playoffs
-
Schedule
- Generic API with all parameters
Schedule()
- Generic API with all parameters
-
Standings
Standings()
- Divisions
Divisions()
- Conferences
Conferences()
- Drafts
Drafts()
- Seasons
Seasons()
- Awards
Awards()
- Venues
Venues()
- Draft prospects
DraftProspects()
- Game Types
GameTypesMd()
- Game Statuses
GameStatusMd()
- Play Types
PlayTypesMd()
- Tournament Types
TournamentTypesMd()
- Standings Types
StandingsTypesMd()
- Stats Types
StatTypesMd()
- Event Types
EventTypesMd()
This package is a Python port of a more mature and feature-rich R package {nhlapi}
. If you are an R user, please check the package out on GitHub and on CRAN.
Thanks go to Drew Hynes for documenting this so well on GitLab.
NHL and the NHL Shield are registered trademarks of the National Hockey League. NHL and NHL team marks are the property of the NHL and its teams. © NHL 2020. All Rights Reserved.