Week
Week Class Documentation
Represents a week's worth of games for a league schedule.
Attributes:
Name | Type | Description |
---|---|---|
espn_instance |
PYESPN
|
The ESPN API instance used to retrieve event data. |
week_list |
list[str]
|
A list of event URLs or event data references for the week. |
week_number |
int
|
The numerical representation of the week (e.g., Week 1, Week 2). |
start_date |
str
|
The start date of the week (ISO 8601 format or as provided). |
end_date |
str
|
The end date of the week (ISO 8601 format or as provided). |
events |
list[Event]
|
A list of Event instances corresponding to each game in the week. |
Methods:
Name | Description |
---|---|
__repr__ |
Returns a string representation of the Week instance showing the week number. |
get_events |
Retrieves the list of Event instances for this week. |
_set_week_data |
(Legacy) Populates the events list sequentially by fetching data for each event. |
_set_week_datav2 |
Populates the events list concurrently using threading for faster data fetching. |
_fetch_event |
str) -> Event: Fetches and returns a single Event instance given a URL. |
Source code in pyespn/classes/schedule.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
espn_instance
property
PYESPN: the espn client instance associated with the class
events
property
list[Event]: a list of Event objects
__init__(espn_instance, week_list, week_number, start_date, end_date)
Initializes a Week instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
espn_instance
|
PyESPN
|
The primary ESPN API wrapper instance. |
required |
week_list
|
list[str]
|
A list of event reference URLs (or identifiers) for games in the week. |
required |
week_number
|
int
|
The numerical representation of the week (e.g., 1 for Week 1). |
required |
start_date
|
str or datetime
|
The start date of the week. |
required |
end_date
|
str or datetime
|
The end date of the week. |
required |
Source code in pyespn/classes/schedule.py
__repr__()
Returns a string representation of the week instance.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A formatted string with the week. |
get_events()
Retrieves the list of Event instances for this week.
Returns:
Type | Description |
---|---|
list[Event]
|
list[Event]: A list of Event instances for the week. |