Skip to content

WBPL games via statsapi-like adaptor api - #767

Merged
WardBrian merged 25 commits into
MLB-LED-Scoreboard:devfrom
WardBrian:wpbl
Aug 9, 2026
Merged

WBPL games via statsapi-like adaptor api#767
WardBrian merged 25 commits into
MLB-LED-Scoreboard:devfrom
WardBrian:wpbl

Conversation

@WardBrian

@WardBrian WardBrian commented Aug 2, 2026

Copy link
Copy Markdown
Member

This adds a new league option (#766) "WPBL"

image image

The Women's Pro Baseball League has an api hosted at https://stats.womensprobaseballleague.com

Known endpoints:

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 from statsapi. 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.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

Team colors changed in this PR! Preview: Team Colors

Comment thread data/game.py Outdated
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},
)

@ty-porter ty-porter Aug 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided the right thing to do is associate each 'league' with its own API. Curious what you think of the latest push

@WardBrian
WardBrian marked this pull request as ready for review August 8, 2026 20:17
@WardBrian
WardBrian requested a review from ty-porter August 8, 2026 21:01
@WardBrian
WardBrian merged commit 69d85de into MLB-LED-Scoreboard:dev Aug 9, 2026
9 checks passed
@WardBrian
WardBrian deleted the wpbl branch August 9, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants