Schedule¶
Schedule-related functionality in Edgework.
Schedule Methods¶
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 or datetime.date or datetime.datetime The start date for which to get the schedule. Strings should be in the format of 'YYYY-MM-DD'; date objects are normalized. end_date : str or datetime.date or datetime.datetime The end date for which to get the schedule. Strings should be in the format of 'YYYY-MM-DD'; date objects are normalized. web : bool, optional Whether to use the web API endpoint. Defaults to True.
Returns¶
Schedule
get_schedule_for_team(team_abbr)
¶
get_schedule_for_team_for_week(team_abbr, date=None)
¶
Get the schedule for the given team for a week.
Uses the documented Web API route
/v1/club-schedule/{team}/week/{date}; when date is omitted the
current week (.../week/now) is fetched.
Parameters¶
team_abbr : str The abbreviation of the team for which to get the schedule. date : str or datetime.date or datetime.datetime, optional A date within the requested week. Strings should be in the format of 'YYYY-MM-DD'; date objects are normalized. Defaults to None (the current week).
Returns¶
Schedule
get_schedule_for_team_for_month(team_abbr, month=None)
¶
Get the schedule for the given team for a month.
Uses the documented Web API route
/v1/club-schedule/{team}/month/{month}; when month is omitted
the current month (.../month/now) is fetched.
Parameters¶
team_abbr : str The abbreviation of the team for which to get the schedule. month : str or datetime.date or datetime.datetime, optional The requested month. Strings should be in the format of 'YYYY-MM'; date objects are truncated to their year/month. Defaults to None (the current month).
Returns¶
Schedule
get_schedule_calendar()
¶
Get the current schedule calendar.
Returns¶
dict Schedule calendar data showing available dates with games.
get_schedule_calendar_for_date(date)
¶
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 or datetime.date or datetime.datetime The start date for which to get the schedule. Strings should be in the format of 'YYYY-MM-DD'; date objects are normalized. end_date : str or datetime.date or datetime.datetime The end date for which to get the schedule. Strings should be in the format of 'YYYY-MM-DD'; date objects are normalized. web : bool, optional Whether to use the web API endpoint. Defaults to True.
Returns¶
Schedule
get_schedule_for_team(team_abbr)
¶
get_schedule_for_team_for_week(team_abbr, date=None)
¶
Get the schedule for the given team for a week.
Uses the documented Web API route
/v1/club-schedule/{team}/week/{date}; when date is omitted the
current week (.../week/now) is fetched.
Parameters¶
team_abbr : str The abbreviation of the team for which to get the schedule. date : str or datetime.date or datetime.datetime, optional A date within the requested week. Strings should be in the format of 'YYYY-MM-DD'; date objects are normalized. Defaults to None (the current week).
Returns¶
Schedule
get_schedule_for_team_for_month(team_abbr, month=None)
¶
Get the schedule for the given team for a month.
Uses the documented Web API route
/v1/club-schedule/{team}/month/{month}; when month is omitted
the current month (.../month/now) is fetched.
Parameters¶
team_abbr : str The abbreviation of the team for which to get the schedule. month : str or datetime.date or datetime.datetime, optional The requested month. Strings should be in the format of 'YYYY-MM'; date objects are truncated to their year/month. Defaults to None (the current month).
Returns¶
Schedule
get_schedule_calendar()
¶
Get the current schedule calendar.
Returns¶
dict Schedule calendar data showing available dates with games.