-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feature: Helpers module. - Contains useful but often expiremental methods for aggregation and analysis
- Loading branch information
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from typing import List | ||
|
||
from nhlpy.http_client import HttpClient | ||
|
||
|
||
class Helpers: | ||
def __init__(self, http_client: HttpClient) -> None: | ||
self.client = http_client | ||
|
||
def get_gameids_by_season(self, season: str, game_types: List[int] = None) -> List[str]: | ||
""" | ||
Get all gameids for a given season. | ||
:param season: The season you want the gameids for. Format is YYYYYYYY. 20202021, 200232024, etc | ||
:param game_types: List of game types you want to include. 2 is regular season, 3 is playoffs, 1 is preseason | ||
""" | ||
from nhlpy.api.teams import Teams | ||
from nhlpy.api.schedule import Schedule | ||
|
||
teams = Teams(self.client).teams_info() | ||
|
||
gameids = [] | ||
schedule_api = Schedule(self.client) | ||
for team in teams: | ||
schedule = schedule_api.get_season_schedule(team["abbr"], season) | ||
for game in schedule["games"]: | ||
if not game_types or game["gameType"] in game_types: | ||
gameids.append(game["id"]) | ||
|
||
return gameids |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "nhl-api-py" | ||
version = "2.16.0" | ||
version = "2.17.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 <[email protected]>"] | ||
readme = "README.md" | ||
|