Skip to content

jozefhajnala/nhlapip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nhlapip - Low-dependency NHL API interface for Python

Install and Test Pandas Showcase CLI Showcase Lint

Installation

Install nhlapip with pip:

pip install nhlapip

Usage

With Python

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.

Command line interface (CLI)

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.

Currently implemented endpoints

Major 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()
  • People (Player)

    • Players metadata Player.get_data()
    • Players all season stats Player.get_stats_allseasons()
  • 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()
  • Tournaments

    • Playoffs Tournament("playoffs")
    • Olympics Tournament("olympics")
    • World Cups Tournament("worldcup")
  • Schedule

    • Generic API with all parameters Schedule()
  • Standings Standings()

Minor endpoints

  • Divisions Divisions()
  • Conferences Conferences()
  • Drafts Drafts()
  • Seasons Seasons()
  • Awards Awards()
  • Venues Venues()
  • Draft prospects DraftProspects()

Metadata endpoints

  • Game Types GameTypesMd()
  • Game Statuses GameStatusMd()
  • Play Types PlayTypesMd()
  • Tournament Types TournamentTypesMd()
  • Standings Types StandingsTypesMd()
  • Stats Types StatTypesMd()
  • Event Types EventTypesMd()

NHL API data for R users

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.

Acknowledgments

Thanks go to Drew Hynes for documenting this so well on GitLab.

Copyright message

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.