Schedule¶
Schedule-related functionality in Edgework.
Schedule Methods¶
Get the current NHL schedule.
Returns:
| Name | Type | Description |
|---|---|---|
Schedule |
Schedule
|
Current NHL schedule with games and season information. |
Get the NHL schedule for a specific date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
str
|
The date in format 'YYYY-MM-DD'. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Schedule |
Schedule
|
NHL schedule for the specified date. |
Get the NHL schedule for a date range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
str
|
The start date in format 'YYYY-MM-DD'. |
required |
end_date
|
str
|
The end date in format 'YYYY-MM-DD'. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Schedule |
Schedule
|
NHL schedule for the specified date range. |
Get team schedule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_code
|
str
|
The team code (e.g., 'TOR', 'NYR'). |
required |
season
|
str
|
The season in format "YYYY-YYYY" (e.g., "2023-2024"). If None, gets current season schedule. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Team schedule data. |
Schedule Model¶
edgework.models.schedule.Schedule(http_client, obj_id=None, **kwargs)
¶
Bases: BaseNHLModel
Schedule model to store schedule information.
Initialize a Schedule object with dynamic attributes.
Args: http_client: The HttpClient obj_id: The ID of the schedule (optional) **kwargs: Dynamic attributes for schedule properties
games
property
¶
Get the games as Game objects.
Returns:
| Type | Description |
|---|---|
List[Game]
|
List[Game]: List of Game objects |
games_today
property
¶
Get games scheduled for today. Returns: List[Game]: List of games scheduled for today
upcoming_games
property
¶
Get upcoming games (future games only).
Returns:
| Type | Description |
|---|---|
List[Game]
|
List[Game]: List of upcoming games |
completed_games
property
¶
Get completed games.
Returns:
| Type | Description |
|---|---|
List[Game]
|
List[Game]: List of completed games |
from_dict(http_client, data)
classmethod
¶
Create a Schedule object from dictionary data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
http_client
|
The HttpClient |
required | |
data
|
dict
|
Dictionary containing schedule data |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Schedule |
Schedule
|
A Schedule object |
from_api(http_client, data)
classmethod
¶
Create a Schedule object from raw API response data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
http_client
|
The HttpClient |
required | |
data
|
dict
|
Raw API response data |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Schedule |
Schedule
|
A Schedule object |
fetch_data()
¶
Fetch the data for the schedule. This method would be called if the schedule needs to be refreshed from the API.
__str__()
¶
Return a human-readable string representation of the schedule.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
String representation of the schedule |
__repr__()
¶
Return a detailed string representation of the schedule.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Detailed representation of the schedule |
Schedule Client¶
edgework.clients.schedule_client.ScheduleClient(client)
¶
get_schedule()
¶
Get the current schedule.
get_schedule_for_date(date)
¶
get_schedule_for_date_range(start_date, end_date, web=True)
¶
Get schedule for the given date range.
Parameters¶
start_date : str The start date for which to get the schedule. Should be in the format of 'YYYY-MM-DD'. end_date : str The end date for which to get the schedule. Should be in the format of 'YYYY-MM-DD'. web : bool, optional Whether to use the web API endpoint. Defaults to True.
Returns¶
Schedule