Skip to content

Commit

Permalink
Added Playoff endpoints. (#50)
Browse files Browse the repository at this point in the history
* added optional date to score_now() for checking the next days scores before noon

* added playoff endpoints

---------

Co-authored-by: Corey Schaf <[email protected]>
Co-authored-by: User Name <[email protected]>
  • Loading branch information
3 people committed Apr 26, 2024
1 parent 968d20c commit 47e8cab
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 @@ -35,3 +35,4 @@ def __init__(
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 47e8cab

Please sign in to comment.