Skip to content

Commit 21239d4

Browse files
authored
Merge pull request #158 from WardBrian/series-status-flag
Add include_series_status flag to schedule()
2 parents ae1d2d9 + ed167bf commit 21239d4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

statsapi/__init__.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def schedule(
5050
game_id=None,
5151
leagueId=None,
5252
season=None,
53+
include_series_status=True,
5354
):
5455
"""Get list of games for a given date/range and/or team/opponent."""
5556
if end_date and not start_date:
@@ -85,13 +86,14 @@ def schedule(
8586
hydrate = (
8687
"decisions,probablePitcher(note),linescore,broadcasts,game(content(media(epg)))"
8788
)
88-
if date == "2014-03-11" or (str(start_date) <= "2014-03-11" <= str(end_date)):
89-
# For some reason the seriesStatus hydration throws a server error on 2014-03-11 only (checked back to 2000)
90-
logger.warning(
91-
"Excluding seriesStatus hydration because the MLB API throws an error for 2014-03-11 which is included in the requested date range."
92-
)
93-
else:
94-
hydrate += ",seriesStatus"
89+
if include_series_status:
90+
if date == "2014-03-11" or (str(start_date) <= "2014-03-11" <= str(end_date)):
91+
# For some reason the seriesStatus hydration throws a server error on 2014-03-11 only (checked back to 2000)
92+
logger.warning(
93+
"Excluding seriesStatus hydration because the MLB API throws an error for 2014-03-11 which is included in the requested date range."
94+
)
95+
else:
96+
hydrate += ",seriesStatus"
9597
params.update(
9698
{
9799
"sportId": str(sportId),

0 commit comments

Comments
 (0)