nhl-core


Namenhl-core JSON
Version 0.0.0 PyPI version JSON
download
home_page
SummaryA package to pull NHL historical data, and create the objects to hold the data.
upload_time2023-09-01 20:24:53
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT
keywords python python3 sports hockey nhl
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NHL Core

[![Build](https://github.com/barbacbd/nhl/workflows/Build/badge.svg?branch=main&event=push)](https://github.com/barbacbd/nhl/actions/workflows/python-app.yml)
[![GitHub latest commit](https://img.shields.io/github/last-commit/barbacbd/nhl)](https://github.com/barbacbd/nhl/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](https://barbacbd.github.io/nhl/).

# Example 

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

```python
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:

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

The user can also access nested values:

```python
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.
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "nhl-core",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "python,python3,sports,hockey,nhl",
    "author": "",
    "author_email": "Brent Barbachem <barbacbd@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7e/c6/755c134632d80e4123b6e001c4f1d379c24167007344b5b110a6b5df4f34/nhl_core-0.0.0.tar.gz",
    "platform": null,
    "description": "# NHL Core\n\n[![Build](https://github.com/barbacbd/nhl/workflows/Build/badge.svg?branch=main&event=push)](https://github.com/barbacbd/nhl/actions/workflows/python-app.yml)\n[![GitHub latest commit](https://img.shields.io/github/last-commit/barbacbd/nhl)](https://github.com/barbacbd/nhl/commit/)\n\nThe 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](https://barbacbd.github.io/nhl/).\n\n# Example \n\nIn the following example, the data for a single team is retrieved.\n\n```python\nfrom nhl import NHLData, API_TEAM_ENDPOINT\nfrom requests import get\n\njson_data = get(API_TEAM_ENDPOINT).json()\nif 'teams' in json_data:\n    print(NHLData(json_data['teams'][0]))\n```\n\nThe result is the following:\n\n```\n{\n    \"id\": 1,\n    \"name\": \"New Jersey Devils\",\n    \"link\": \"/api/v1/teams/1\",\n    \"venue\": {\n        \"name\": \"Prudential Center\",\n        \"link\": \"/api/v1/venues/null\",\n        \"city\": \"Newark\",\n        \"timeZone\": {\n            \"id\": \"America/New_York\",\n            \"offset\": -4,\n            \"tz\": \"EDT\"\n        }\n    },\n    \"abbreviation\": \"NJD\",\n    \"teamName\": \"Devils\",\n    \"locationName\": \"New Jersey\",\n    \"firstYearOfPlay\": \"1982\",\n    \"division\": {\n        \"id\": 18,\n        \"name\": \"Metropolitan\",\n        \"nameShort\": \"Metro\",\n        \"link\": \"/api/v1/divisions/18\",\n        \"abbreviation\": \"M\"\n    },\n    \"conference\": {\n        \"id\": 6,\n        \"name\": \"Eastern\",\n        \"link\": \"/api/v1/conferences/6\"\n    },\n    \"franchise\": {\n        \"franchiseId\": 23,\n        \"teamName\": \"Devils\",\n        \"link\": \"/api/v1/franchises/23\"\n    },\n    \"shortName\": \"New Jersey\",\n    \"officialSiteUrl\": \"http://www.newjerseydevils.com/\",\n    \"franchiseId\": 23,\n    \"active\": true\n}\n```\n\nThe user could also access the values directly. For instance getting the `teamName` would require:\n\n```python\nprint(NHLData(json_data['teams'][0].teamName))\n```\n\nThe user can also access nested values:\n\n```python\nprint(NHLData(json_data['teams'][0].franchise.franchiseId))\n```\n\n# Copyright\n\nAll 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:\n\n```\nNHL 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. \u00a9 NHL 2023. All Rights Reserved.\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package to pull NHL historical data, and create the objects to hold the data.",
    "version": "0.0.0",
    "project_urls": null,
    "split_keywords": [
        "python",
        "python3",
        "sports",
        "hockey",
        "nhl"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4143c3d4734d74977f873efe8a65d8068be7211c890b603f9b3b2352db178ba4",
                "md5": "9060ed737e3f9d3e1824644f1928e0ab",
                "sha256": "ea508e5ae110d0962993565657581cdebfa2bde76d6839de2d1d3cd81f27fc21"
            },
            "downloads": -1,
            "filename": "nhl_core-0.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9060ed737e3f9d3e1824644f1928e0ab",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 20779,
            "upload_time": "2023-09-01T20:24:52",
            "upload_time_iso_8601": "2023-09-01T20:24:52.566236Z",
            "url": "https://files.pythonhosted.org/packages/41/43/c3d4734d74977f873efe8a65d8068be7211c890b603f9b3b2352db178ba4/nhl_core-0.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ec6755c134632d80e4123b6e001c4f1d379c24167007344b5b110a6b5df4f34",
                "md5": "658a6e1d9ecff97eea194e00aa5f1904",
                "sha256": "5de1a08774dfefd035b3890b19f684183d5ce25fbdb27be87190be31aa17178d"
            },
            "downloads": -1,
            "filename": "nhl_core-0.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "658a6e1d9ecff97eea194e00aa5f1904",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 58113,
            "upload_time": "2023-09-01T20:24:53",
            "upload_time_iso_8601": "2023-09-01T20:24:53.818655Z",
            "url": "https://files.pythonhosted.org/packages/7e/c6/755c134632d80e4123b6e001c4f1d379c24167007344b5b110a6b5df4f34/nhl_core-0.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-01 20:24:53",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "nhl-core"
}
        
Elapsed time: 0.12999s