diff --git a/nhlpy/_version.py b/nhlpy/_version.py index 91de826..d0dbb96 100644 --- a/nhlpy/_version.py +++ b/nhlpy/_version.py @@ -1,3 +1,3 @@ # Should this be driven by the main pyproject.toml file? yes, is it super convoluted? yes, can it wait? sure -__version__ = "2.7.1" +__version__ = "2.8.0" diff --git a/nhlpy/api/teams.py b/nhlpy/api/teams.py index 06a082a..6fcf838 100644 --- a/nhlpy/api/teams.py +++ b/nhlpy/api/teams.py @@ -1,6 +1,5 @@ import json import importlib.resources -from warnings import warn from typing import List from nhlpy.http_client import HttpClient @@ -12,29 +11,11 @@ def __init__(self, http_client: HttpClient) -> None: self.base_url = "https://api.nhle.com" self.api_ver = "/stats/rest/" - # todo deprecate this - def team_stats_summary(self, lang="en") -> List[dict]: - """ - I really don't know what this endpoint does. It returns a list of dicts with team stats. - :param lang: Language param. 'en' for English, 'fr' for French - :return: - """ - warn( - "This endpoint will be deprecated in the future. Use stats.team_summary() instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.client.get_by_url(full_resource=f"{self.base_url}{self.api_ver}{lang}/team/summary").json()["data"] - def teams_info(self) -> dict: """ Returns a list of dicts with all the teams info. This is loaded via a harccoded json file. :return: dict """ - - # with importlib.resources.files("nhlpy.data", "teams_20232024.json") as f: - # return json.load(f)['teams'] - data_resource = importlib.resources.files("nhlpy") / "data" teams_info = json.loads((data_resource / "teams_20232024.json").read_text())["teams"] return teams_info diff --git a/nhlpy/data/team_stat_ids.json b/nhlpy/data/team_stat_ids.json index d1116e4..150ca04 100644 --- a/nhlpy/data/team_stat_ids.json +++ b/nhlpy/data/team_stat_ids.json @@ -233,7 +233,13 @@ "fullName": "Seattle Kraken", "teamCommonName": "Kraken", "teamPlaceName": "Seattle" + }, + { + "id": 40, + "fullName": "Utah Hockey Club", + "teamCommonName": "Hockey Club", + "teamPlaceName": "Utah" } ], - "total": 39 + "total": 40 } \ No newline at end of file diff --git a/nhlpy/data/teams_20232024.json b/nhlpy/data/teams_20232024.json index ea47bf3..8ba5678 100644 --- a/nhlpy/data/teams_20232024.json +++ b/nhlpy/data/teams_20232024.json @@ -31,6 +31,7 @@ { "id": "23", "abbreviation": "VAN", "name": "Vancouver Canucks" }, { "id": "54", "abbreviation": "VGK", "name": "Vegas Golden Knights" }, { "id": "15", "abbreviation": "WSH", "name": "Washington Capitals" }, - { "id": "52", "abbreviation": "WPG", "name": "Winnipeg Jets" } + { "id": "52", "abbreviation": "WPG", "name": "Winnipeg Jets" }, + { "id": "40", "abbreviation": "UTA", "name": "Utah Hockey Club"} ] } diff --git a/pyproject.toml b/pyproject.toml index b7d7056..5e6d6dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "nhl-api-py" -version = "2.7.1" +version = "2.8.0" description = "NHL API (Updated for 2024/2025) and EDGE Stats. For standings, team stats, outcomes, player information. Contains each individual API endpoint as well as convience methods as well as pythonic query builder for more indepth EDGE stats." authors = ["Corey Schaf "] readme = "README.md" diff --git a/tests/test_teams.py b/tests/test_teams.py index 4a0cfde..08a4072 100644 --- a/tests/test_teams.py +++ b/tests/test_teams.py @@ -1,13 +1,6 @@ from unittest import mock -@mock.patch("httpx.Client.get") -def test_stats_summary(h_m, nhl_client): - nhl_client.teams.team_stats_summary() - h_m.assert_called_once() - assert h_m.call_args[1]["url"] == "https://api.nhle.com/stats/rest/en/team/summary" - - @mock.patch("httpx.Client.get") def test_roster(h_m, nhl_client): nhl_client.teams.roster(team_abbr="BUF", season="20202021") @@ -17,4 +10,4 @@ def test_roster(h_m, nhl_client): def test_teams_info(nhl_client): teams = nhl_client.teams.teams_info() - assert len(teams) == 32 + assert len(teams) == 33