Closed BrayanMnz closed 7 months ago
FYI @toddrob99
Hi, @toddrob99 could you merge this?
@BrayanMnz, can you give me an example of how you are looking to use this? The sportId
parameter is already there, and that's the one that lets you retrieve the schedule outside MLB (for example, AAA):
> aaa_schedule = statsapi.schedule(date="2024-05-01", sportId=11)
> print(aaa_schedule[-1]["summary"])
2024-05-01 - Reno Aces @ Las Vegas Aviators (Scheduled)
The leagueId
parameter would allow you to filter the results to one league within the given sport (for example, only retrieve American League schedule for sportId=1/MLB), but the current functionality does allow retrieving data for any league as far as I can tell.
Hi, @toddrob99 in the list of http://statsapi.mlb.com/api/v1/sports we have all the winter leagues under the same sportId (17), I am looking to use the leagueId parameter so that I can retrieve for example just the data for the Dominican Winter League using leagueId=131
eg:
winter_leagues_schedule = statsapi.schedule(date="2023-12-18", sportId=17)
for i in winter_leagues_schedule:
print(i["summary"])
output
2023-12-18 - Estrellas Orientales @ Toros del Este (Scheduled)
2023-12-18 - Estrellas Occidente @ Estrellas Oriente (Scheduled)
Looking forward to continuing to contribute to this amazing work you have done, let me know how to help you and if there is any roadmap defined.
Included in v1.7.1
Add support for leagueId so we can retrieve data from leagues different to MLB.
In the list of http://statsapi.mlb.com/api/v1/sports we have all the winter leagues under the same sportId (17), I am looking to use the leagueId parameter so that I can retrieve for example just the data for the Dominican Winter League using leagueId=131
eg:
output
two games from two different Winter Leagues would be great to add the granularity of filtering by league :smile: