WBPL games via statsapi-like adaptor api - #767
Merged
Merged
Conversation
|
Team colors changed in this PR! Preview: Team Colors |
no-op when only one api, but cheap
ty-porter
approved these changes
Aug 8, 2026
Comment on lines
+72
to
+83
| if wpbl_statsapi_adaptor.is_wpbl_game(self.game_id): | ||
| live_data = wpbl_statsapi_adaptor.game( | ||
| {"gamePk": self.game_id, "fields": API_FIELDS} | testing_params, | ||
| request_kwargs={"headers": data.headers.API_HEADERS}, | ||
| ) | ||
|
|
||
| else: | ||
| live_data = statsapi.get( | ||
| "game", | ||
| {"gamePk": self.game_id, "fields": API_FIELDS} | testing_params, | ||
| request_kwargs={"headers": data.headers.API_HEADERS}, | ||
| ) |
Contributor
There was a problem hiding this comment.
Not opposed to this as-is to get beta support out for WPBL
I think these should be a true adapter pattern -- pass game ID to the top-level adapter which selects either statsapi or WPBL as the request backend. (I think this is what you were discussing in Discord, just calling it out explicitly).
Either way, this an easy refactor if we don't do this now.
Member
Author
There was a problem hiding this comment.
I decided the right thing to do is associate each 'league' with its own API. Curious what you think of the latest push
WardBrian
marked this pull request as ready for review
August 8, 2026 20:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a new league option (#766) "WPBL"
The Women's Pro Baseball League has an api hosted at https://stats.womensprobaseballleague.com
Known endpoints:
v1/gameshttps://stats.womensprobaseballleague.com/v1/gamesv1/games/{ID}https://stats.womensprobaseballleague.com/v1/games/8alsgvzc90ypwphlv1/games/{ID}/boxscorehttps://stats.womensprobaseballleague.com/v1/games/8alsgvzc90ypwphl/boxscorev1/teamshttps://stats.womensprobaseballleague.com/v1/teamsv1/teams/{ID}https://stats.womensprobaseballleague.com/v1/teams/v4gisr4rbgmn67b0/This API is fairly different from
statsapi. To get something basic off the ground and edit as little as possible, I wrote a small wpbl_statsapi_adaptor which queries these and returns objects that look more like what we expect fromstatsapi. There are definitely some missing values (e.g., I can't find a way to get the due up batters, or the winning pitcher), but it seems fine for basic display.Will need to monitor as a live game actually happens and update accordingly. We might also run into rate limiting issues with our default refresh rates.