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.
1 parent e949dcd commit 90adba4Copy full SHA for 90adba4
statsapi/__init__.py
@@ -1209,14 +1209,11 @@ def latest_season(sportId=1):
1209
all_seasons = get("season", params)
1210
return next(
1211
(
1212
- x
1213
- for x in all_seasons.get("seasons", [])
1214
- if x.get("seasonStartDate")
1215
- and x.get("seasonEndDate")
1216
- and (
1217
- x["seasonStartDate"]
1218
- < datetime.today().strftime("%Y-%m-%d")
1219
- < x["seasonEndDate"]
+ s
+ for s in all_seasons.get("seasons", [])
+ if (
+ datetime.today().strftime("%Y-%m-%d")
+ < s.get("seasonEndDate", "")
1220
)
1221
),
1222
all_seasons["seasons"][-1],
0 commit comments