Skip to main content

A package to pull NHL historical data, and create the objects to hold the data.

Project description

NHL Core

Build GitHub latest commit

The National Hockey League (NHL) was kind enough to provide all of the historical data on a free web interface. This library was created to parse the data that is retrieved from the api. After json data is retrieved it can be parsed by passing it to an NHLData python object. The documentation can be found here.

Example

In the following example, the data for a single team is retrieved.

from nhl import NHLData, API_TEAM_ENDPOINT
from requests import get

json_data = get(API_TEAM_ENDPOINT).json()
if 'teams' in json_data:
    print(NHLData(json_data['teams'][0]))

The result is the following:

{
    "id": 1,
    "name": "New Jersey Devils",
    "link": "/api/v1/teams/1",
    "venue": {
        "name": "Prudential Center",
        "link": "/api/v1/venues/null",
        "city": "Newark",
        "timeZone": {
            "id": "America/New_York",
            "offset": -4,
            "tz": "EDT"
        }
    },
    "abbreviation": "NJD",
    "teamName": "Devils",
    "locationName": "New Jersey",
    "firstYearOfPlay": "1982",
    "division": {
        "id": 18,
        "name": "Metropolitan",
        "nameShort": "Metro",
        "link": "/api/v1/divisions/18",
        "abbreviation": "M"
    },
    "conference": {
        "id": 6,
        "name": "Eastern",
        "link": "/api/v1/conferences/6"
    },
    "franchise": {
        "franchiseId": 23,
        "teamName": "Devils",
        "link": "/api/v1/franchises/23"
    },
    "shortName": "New Jersey",
    "officialSiteUrl": "http://www.newjerseydevils.com/",
    "franchiseId": 23,
    "active": true
}

The user could also access the values directly. For instance getting the teamName would require:

print(NHLData(json_data['teams'][0].teamName))

The user can also access nested values:

print(NHLData(json_data['teams'][0].franchise.franchiseId))

Copyright

All data is owned by the NHL. The result of each query will contain a copyright that should be included in all work. An example is shown below:

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

nhl_core-0.0.0.tar.gz (58.1 kB view details)

Uploaded Source

Built Distribution

nhl_core-0.0.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file nhl_core-0.0.0.tar.gz.

File metadata

  • Download URL: nhl_core-0.0.0.tar.gz
  • Upload date:
  • Size: 58.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for nhl_core-0.0.0.tar.gz
Algorithm Hash digest
SHA256 5de1a08774dfefd035b3890b19f684183d5ce25fbdb27be87190be31aa17178d
MD5 658a6e1d9ecff97eea194e00aa5f1904
BLAKE2b-256 7ec6755c134632d80e4123b6e001c4f1d379c24167007344b5b110a6b5df4f34

See more details on using hashes here.

File details

Details for the file nhl_core-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: nhl_core-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for nhl_core-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea508e5ae110d0962993565657581cdebfa2bde76d6839de2d1d3cd81f27fc21
MD5 9060ed737e3f9d3e1824644f1928e0ab
BLAKE2b-256 4143c3d4734d74977f873efe8a65d8068be7211c890b603f9b3b2352db178ba4

See more details on using hashes here.

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