Closed aulttd01 closed 1 year ago
I'm not exactly sure what you're hoping to accomplish by making the season
parameter unrequired. If it's left out, it appears to default to 2022
currently. At some point it will start defaulting to 2023 and then it will again exclude unsigned free agents. It seems better to specify the season so you will know what response to expect. If you really want to leave it out and let the API decide what to return, you can add force=True
to your statsapi.get()
call: statsapi.get("sports_players", {}, force=True)
.
Please also note that the StatsAPI documentation says season
is a required parameter. That's why it is required in this wrapper. I realize the API uses a default value, but thought it was worth mentioning I didn't decide on my own to make it required.
Thanks for the follow up - my bad on not seeing that MLB was defaulting to 2022 on their end when season
is omitted. For some reason I just assumed it was returning all active players, but that makes sense it would default to something.
For context, I'm building a player comparison tool and using this wrapper for career stats comparisons. That's why I was wondering if there's a way I could drop the season. My "beta" version was going to be active player career comp's only. Was going to expand eventually to all players and allow season selection, too.
Can the
season
requirement be dropped from thesports_players
endpoint? MLB is excluding unsigned FA's when queryingapi/v1/sports/1/players?season=[season]
so players like Carlos Correa and Gary Sanchez aren't showing. But when I drop the query param on the MLB side (or query for last season), I get those players coming back