NHL Core
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.
Metadata
Release files for nhl-core 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nhl_core-0.0.0.tar.gz | 58.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nhl_core-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.9 kB
Release files / nhl_core-0.0.0.tar.gz
| Download URL | nhl_core-0.0.0.tar.gz |
|---|---|
| Size | 58.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5de1a08774dfefd035b3890b19f684183d5ce25fbdb27be87190be31aa17178d
|
|
BLAKE2b-256 checksum How to use checksums |
7ec6755c134632d80e4123b6e001c4f1d379c24167007344b5b110a6b5df4f34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / nhl_core-0.0.0-py3-none-any.whl
| Download URL | nhl_core-0.0.0-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea508e5ae110d0962993565657581cdebfa2bde76d6839de2d1d3cd81f27fc21
|
|
BLAKE2b-256 checksum How to use checksums |
4143c3d4734d74977f873efe8a65d8068be7211c890b603f9b3b2352db178ba4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|