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

  • 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.

Project details


Download files

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

Source Distribution

nhlapip-0.0.1.tar.gz (11.5 kB view hashes)

Uploaded Source

Built Distributions

nhlapip-0.0.1-py3.8.egg (22.1 kB view hashes)

Uploaded Source

nhlapip-0.0.1-py3.6.egg (61.7 kB view hashes)

Uploaded Source

nhlapip-0.0.1-py3-none-any.whl (36.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page