toddrob99 / MLB-StatsAPI

Python wrapper for MLB Stats API
GNU General Public License v3.0
510 stars 97 forks source link

Standings_data division parameter should accept divisionId instead of only abbreviation #115

Closed justintran12 closed 11 months ago

justintran12 commented 1 year ago

Here is the documentation for the function: statsapi.standings_data(leagueId="103,104", division="all", include_wildcard=True, season=None, standingsTypes=None, date=None). Doing statsapi.standings_data(division = "200") or statsapi.standings_data("103", "200") returns empty dict.

I found I can just do this statsapi.standings_data(leagueId = "103")[200]) to get the division standings, so it's not a big deal, but just wanted to document the issue.

toddrob99 commented 1 year ago

I updated the statsapi.standings_data() wiki page to clarify that the division parameter currently accepts the division abbreviation, not the id. I will keep this issue open to add support for division ids in the division field in addition to the abbreviations.

>>> statsapi.standings_data(leagueId="104", division="NLE")
{204: {'div_name': 'National League East', 'teams': [{'name': 'Atlanta Braves', 'div_rank': '1', 'w': 37, 'l': 24, 'gb': '-', 'wc_rank': '-', 'wc_gb': '-', 'wc_elim_num': '-', 'elim_num': '-', 'team_id': 144, 'league_rank': '1', 'sport_rank': '1'}, {'name': 'Miami Marlins', 'div_rank': '2', 'w': 35, 'l': 28, 'gb': '3.0', 'wc_rank': '2', 'wc_gb': '+2.0', 'wc_elim_num': '-', 'elim_num': '98', 'team_id': 146, 'league_rank': '4', 'sport_rank': '4'}, {'name': 'New York Mets', 'div_rank': '3', 'w': 30, 'l': 32, 'gb': '7.5', 'wc_rank': '5', 'wc_gb': '2.5', 'wc_elim_num': '99', 'elim_num': '94', 'team_id': 121, 'league_rank': '8', 'sport_rank': '8'}, {'name': 'Philadelphia Phillies', 'div_rank': '4', 'w': 29, 'l': 32, 'gb': '8.0', 'wc_rank': '6', 'wc_gb': '3.0', 'wc_elim_num': '99', 'elim_num': '94', 'team_id': 143, 'league_rank': '9', 'sport_rank': '9'}, {'name': 'Washington Nationals', 'div_rank': '5', 'w': 25, 'l': 36, 'gb': '12.0', 'wc_rank': '12', 'wc_gb': '7.0', 'wc_elim_num': '95', 'elim_num': '90', 'team_id': 120, 'league_rank': '15', 'sport_rank': '15'}]}}
SigireddyBalasai commented 1 year ago

i want to work on this

toddrob99 commented 1 year ago

i want to work on this

That's great, please feel free to submit a pull request.

jimcreel commented 11 months ago

I submitted a pull request for this enhancement if the issue is still available.

toddrob99 commented 11 months ago

released in v1.6.2