Games¶
Game-related functionality in Edgework.
Game Events¶
edgework.models.game_events.GameEvent(edgework_client, obj_id=None, **kwargs)
¶
Bases: BaseNHLModel
GameEvent model to store game event information.
Initialize a GameEvent object with dynamic attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edgework_client
|
The Edgework client |
required | |
obj_id
|
The ID of the event |
None
|
|
**kwargs
|
Dynamic attributes for game event properties |
{}
|
fetch_data()
¶
Fetch the data for the game event.
edgework.models.game_events.GameLog(edgework_client, obj_id=None, game_id=None, season=None, date=None, events=None)
¶
Bases: BaseNHLModel
GameLog model to store game log information.
Initialize a GameLog object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edgework_client
|
The Edgework client |
required | |
obj_id
|
The ID of the game log |
None
|
|
game_id
|
Game ID is the unique identifier for the game |
None
|
|
season
|
Season is the season the game was played in |
None
|
|
date
|
Date is the date the game was played |
None
|
|
events
|
Events is a list of GameEvent objects that occurred in the game |
None
|
fetch_data()
¶
Fetch the data for the game log.
Game Client¶
edgework.clients.game_client.GameClient(client)
¶
Client for fetching NHL game data.
get_game(game_id)
¶
Fetch game boxscore data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
int
|
The NHL game ID. |
required |
Returns:
| Type | Description |
|---|---|
Game
|
Game object with boxscore data. |
get_play_by_play(game_id)
¶
Fetch play-by-play data for a game.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
int
|
The NHL game ID. |
required |
Returns:
| Type | Description |
|---|---|
PlayByPlay
|
PlayByPlay object with full play-by-play data. |
get_game_landing(game_id)
¶
Fetch game landing page data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
int
|
The NHL game ID. |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary with comprehensive game landing data. |
get_game_boxscore(game_id)
¶
Fetch game boxscore data as raw dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
int
|
The NHL game ID. |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary with boxscore data. |
get_game_story(game_id)
¶
Fetch game story/narrative data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
int
|
The NHL game ID. |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary with game story data. |
get_game_right_rail(game_id)
¶
Fetch game right rail data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
int
|
The NHL game ID. |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary with right rail game information. |
get_score(date=None)
¶
Fetch score data for a specific date or current scores.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
Optional[Union[datetime, str]]
|
Date for scores. If None, fetches current scores. Can be datetime object or string in YYYY-MM-DD format. |
None
|
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary with score data for the specified date. |
get_scoreboard()
¶
Fetch current scoreboard data.
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary with current scoreboard information. |
get_where_to_watch(country_code='US')
¶
Fetch broadcast information for games.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
country_code
|
str
|
Country code for broadcast info (default: "US"). |
'US'
|
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary with where to watch information. |
get_shifts(game_id)
¶
Fetch shift data for a game.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_id
|
int
|
The NHL game ID. |
required |
Returns:
| Type | Description |
|---|---|
List[Shift]
|
List of Shift objects. |
get_games_for_date(date)
¶
Fetch all games for a specific date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
Union[datetime, str]
|
Date to fetch games for. Can be datetime or YYYY-MM-DD string. |
required |
Returns:
| Type | Description |
|---|---|
List[Game]
|
List of Game objects for that date. |
get_current_games()
¶
Fetch all current/upcoming games.
Returns:
| Type | Description |
|---|---|
List[Game]
|
List of Game objects for current games. |