Skip to main content

A minimum-dependency Python interface to the NHL API.

Project description

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

  • <input type="checkbox" checked="" disabled="" />

    Teams

    • <input type="checkbox" checked="" disabled="" /> Team Metadata Team().get_data()
      • <input type="checkbox" checked="" disabled="" /> Team Rosters Team().get_roster()
      • <input type="checkbox" checked="" disabled="" /> Team Schedules Team().get_schedule_next(), Team().get_schedule_previous()
      • <input type="checkbox" checked="" disabled="" /> Team Stats Team().get_stats()
  • <input type="checkbox" checked="" disabled="" />

    People (Player)

    • <input type="checkbox" checked="" disabled="" /> Players metadata Player.get_data()
      • <input type="checkbox" checked="" disabled="" /> Players all season stats Player.get_stats_allseasons()
  • <input type="checkbox" checked="" disabled="" />

    Games (Game)

    • <input type="checkbox" checked="" disabled="" /> Games content Game.get_content()
      • <input type="checkbox" checked="" disabled="" /> Games full live feed Game.get_feed()
      • <input type="checkbox" checked="" disabled="" /> Games box score info Game.get_boxscore()
      • <input type="checkbox" checked="" disabled="" /> Games line score info Game.get_linescore()
  • <input type="checkbox" checked="" disabled="" />

    Tournaments

    • <input type="checkbox" checked="" disabled="" /> Playoffs Tournament("playoffs")
      • <input type="checkbox" checked="" disabled="" /> Olympics Tournament("olympics")
      • <input type="checkbox" checked="" disabled="" /> World Cups Tournament("worldcup")
  • <input type="checkbox" checked="" disabled="" />

    Schedule

    • <input type="checkbox" checked="" disabled="" /> Generic API with all parameters Schedule()
  • <input type="checkbox" checked="" disabled="" />

    Standings Standings()

Minor endpoints

  • <input type="checkbox" checked="" disabled="" /> Divisions Divisions()
  • <input type="checkbox" checked="" disabled="" /> Conferences Conferences()
  • <input type="checkbox" checked="" disabled="" /> Drafts Drafts()
  • <input type="checkbox" checked="" disabled="" /> Seasons Seasons()
  • <input type="checkbox" checked="" disabled="" /> Awards Awards()
  • <input type="checkbox" checked="" disabled="" /> Venues Venues()
  • <input type="checkbox" checked="" disabled="" /> Draft prospects DraftProspects()

Metadata endpoints

  • <input type="checkbox" checked="" disabled="" /> Game Types GameTypesMd()
  • <input type="checkbox" checked="" disabled="" /> Game Statuses GameStatusMd()
  • <input type="checkbox" checked="" disabled="" /> Play Types PlayTypesMd()
  • <input type="checkbox" checked="" disabled="" /> Tournament Types TournamentTypesMd()
  • <input type="checkbox" checked="" disabled="" /> Standings Types StandingsTypesMd()
  • <input type="checkbox" checked="" disabled="" /> Stats Types StatTypesMd()
  • <input type="checkbox" checked="" disabled="" /> 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nhlapip, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size nhlapip-0.0.1-py3.6.egg (61.7 kB) File type Egg Python version 3.6 Upload date Hashes View
Filename, size nhlapip-0.0.1-py3.8.egg (22.1 kB) File type Egg Python version 3.8 Upload date Hashes View
Filename, size nhlapip-0.0.1-py3-none-any.whl (36.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size nhlapip-0.0.1.tar.gz (11.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page