Skip to content

Commit

Permalink
added playoff endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
User Name committed Apr 23, 2024
1 parent 1920785 commit e03698b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
49 changes: 49 additions & 0 deletions nhlpy/api/playoff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from nhlpy.http_client import HttpClient


class Playoff:
def __init__(self, http_client: HttpClient):
self.client = http_client

def carousel(self, season: str) -> dict:
"""
Get the list of all series games. Currently only
shows Round 1 games
:param season: the current season ex. "20232024"
example:
https://api-web.nhle.com/v1/playoff-series/carousel/20232024/
:return: dict
"""
return self.client.get(resource=f"playoff-series/carousel/{season}").json()

def schedule(self, season: str, series: str) -> dict:
"""
Returns the schedule for a specified series.
:param season: the the season you wish to see the schedule of
:param series: the series (a-h) for Round 1
example:
https://api-web.nhle.com/v1/schedule/playoff-series/20232024/a/
:return: dict
"""

return self.client.get(resource=f"schedule/playoff-series/{season}/{series}").json()

def bracket(self, year: str) -> dict:
"""
Returns the playoff bracket
:param year: the year the playoffs are taking place ex. "2024"
example:
https://api-web.nhle.com/v1/playoff-bracket/2024
:return: dict
"""

return self.client.get(resource=f"playoff-bracket/{year}").json()
3 changes: 2 additions & 1 deletion nhlpy/nhl_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from nhlpy.api import teams, standings, schedule, game_center, stats, misc
from nhlpy.api import teams, standings, schedule, game_center, stats, misc, playoff
from nhlpy.http_client import HttpClient
from nhlpy.config import ClientConfig

Expand Down Expand Up @@ -26,3 +26,4 @@ def __init__(self, verbose: bool = False) -> None:
self.game_center = game_center.GameCenter(http_client=self._http_client)
self.stats = stats.Stats(http_client=self._http_client)
self.misc = misc.Misc(http_client=self._http_client)
self.playoff = playoff.Playoff(http_client=self._http_client)

0 comments on commit e03698b

Please sign in to comment.