From 6a21a36c6aafcf89087cbd0aa54d0553d7e936db Mon Sep 17 00:00:00 2001 From: Corey Schaf Date: Sun, 27 Oct 2024 16:10:59 -0400 Subject: [PATCH] 75 odds fix (#76) * Fix: Schedule.get_schedule - adds better key extraction on payload when using past seasons --- nhlpy/api/schedule.py | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nhlpy/api/schedule.py b/nhlpy/api/schedule.py index 5528f00..e7bca3a 100644 --- a/nhlpy/api/schedule.py +++ b/nhlpy/api/schedule.py @@ -22,10 +22,10 @@ def get_schedule(self, date: str = None) -> dict: schedule_data: dict = self.client.get(resource=f"schedule/{date}").json() response_payload = { - "nextStartDate": schedule_data["nextStartDate"], - "previousStartDate": schedule_data["previousStartDate"], + "nextStartDate": schedule_data.get("nextStartDate", None), + "previousStartDate": schedule_data.get("previousStartDate", None), "date": date, - "oddsPartners": schedule_data["oddsPartners"], + "oddsPartners": schedule_data.get("oddsPartners", None), } matching_day = next((day for day in schedule_data["gameWeek"] if day["date"] == date), None) diff --git a/pyproject.toml b/pyproject.toml index 57bdc60..cde3e4a 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.12.0" +version = "2.12.1" 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"