We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 63369fa + 90adba4 commit ae1d2d9Copy full SHA for ae1d2d9
statsapi/__init__.py
@@ -1213,14 +1213,11 @@ def latest_season(sportId=1):
1213
all_seasons = get("season", params)
1214
return next(
1215
(
1216
- x
1217
- for x in all_seasons.get("seasons", [])
1218
- if x.get("seasonStartDate")
1219
- and x.get("seasonEndDate")
1220
- and (
1221
- x["seasonStartDate"]
1222
- < datetime.today().strftime("%Y-%m-%d")
1223
- < x["seasonEndDate"]
+ s
+ for s in all_seasons.get("seasons", [])
+ if (
+ datetime.today().strftime("%Y-%m-%d")
+ < s.get("seasonEndDate", "")
1224
)
1225
),
1226
all_seasons["seasons"][-1],
0 commit comments