Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for leagueId so we can retrieve data from other leagues #132

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

BrayanMnz
Copy link
Contributor

@BrayanMnz BrayanMnz commented Nov 29, 2023

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:

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)

two games from two different Winter Leagues would be great to add the granularity of filtering by league 😄

@BrayanMnz BrayanMnz changed the title Add support for leagueId so we can retrieve data from a league differ… Add support for leagueId so we can retrieve data from other leagues Nov 29, 2023
@BrayanMnz
Copy link
Contributor Author

FYI @toddrob99

@BrayanMnz
Copy link
Contributor Author

Hi, @toddrob99 could you merge this?

@toddrob99
Copy link
Owner

toddrob99 commented Dec 18, 2023

@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.

@toddrob99 toddrob99 self-assigned this Dec 18, 2023
@toddrob99 toddrob99 added the enhancement New feature or request label Dec 18, 2023
@BrayanMnz
Copy link
Contributor Author

BrayanMnz commented Dec 18, 2023

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)

two games from two different Winter Leagues would be great to add the granularity of filtering by league 😄

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.

@toddrob99 toddrob99 changed the base branch from master to develop December 18, 2023 19:22
@toddrob99 toddrob99 merged commit fe52456 into toddrob99:develop Dec 18, 2023
@toddrob99 toddrob99 mentioned this pull request Dec 18, 2023
@toddrob99
Copy link
Owner

Included in v1.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants