From b27ad275df731c286b84c372d3ff7c97de323379 Mon Sep 17 00:00:00 2001 From: Will DeBerry Date: Sun, 24 Nov 2024 20:33:29 -0500 Subject: [PATCH] Add support for the wsc/game-story API endpoint --- nhlpy/api/wsc.py | 13 +++++++++++++ nhlpy/nhl_client.py | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 nhlpy/api/wsc.py diff --git a/nhlpy/api/wsc.py b/nhlpy/api/wsc.py new file mode 100644 index 0000000..bde4d65 --- /dev/null +++ b/nhlpy/api/wsc.py @@ -0,0 +1,13 @@ +from nhlpy.http_client import HttpClient + +class Wsc: + def __init__(self, http_client: HttpClient): + self.client = http_client + + def game_story(self, game_id: str) -> dict: + """ + Get game story information for the game id. GameIds can be retrieved from the schedule endpoint. + :param game_id: The game_id for the game you want the game story for. + :return: dict + """ + return self.client.get(resource=f"wsc/game-story/{game_id}").json() diff --git a/nhlpy/nhl_client.py b/nhlpy/nhl_client.py index f78b28e..4c245e6 100644 --- a/nhlpy/nhl_client.py +++ b/nhlpy/nhl_client.py @@ -1,4 +1,4 @@ -from nhlpy.api import teams, standings, schedule, game_center, stats, misc, playoffs +from nhlpy.api import teams, standings, schedule, game_center, stats, misc, playoffs, wsc from nhlpy.http_client import HttpClient from nhlpy.config import ClientConfig @@ -36,3 +36,4 @@ def __init__( self.stats = stats.Stats(http_client=self._http_client) self.misc = misc.Misc(http_client=self._http_client) self.playoffs = playoffs.Playoffs(http_client=self._http_client) + self.wsc = wsc.Wsc(http_client=self._http_client)