MLB-StatsAPI
MLB Stats API Wrapper for Python
What it is and what it does
MLB-StatsAPI is a Python wrapper around MLB's public Stats API that lets you programmatically retrieve baseball data—games, scores, player stats, team information, and more. It abstracts away the HTTP details by wrapping requests, so you can focus on querying the data you need rather than building API calls manually.
The package is maintained actively with recent development and has a straightforward install with minimal dependencies. It's designed for developers building baseball-related applications, data analysis tools, or dashboards that need live or historical MLB information. Note that this is an unofficial wrapper; data usage is subject to MLB's terms, and the package is not affiliated with MLB or any MLB team.
Use it for:
- Build a dashboard or web app that displays live MLB game scores and standings
- Analyze historical player statistics or team performance across seasons
- Create alerts or notifications for specific teams, players, or game outcomes
- Populate a database with MLB data for research or fantasy baseball applications
- Integrate MLB data into a sports news or stats aggregation tool
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python access to MLB's Stats API, allowing you to query baseball statistics, game data, player information, and other MLB-related data programmatically.
Yes, if you need programmatic access to MLB data. Low install friction, active maintenance, no known vulnerabilities, and a single lightweight dependency make it straightforward to adopt. The GPLv3 license requires that any derivative work also be open-source, so verify that aligns with your project's licensing model before committing.
Install
mlb-statsapi on PyPI
pip
pip install mlb-statsapiuv
uv add mlb-statsapipoetry
poetry add mlb-statsapiInstalling MLB-StatsAPI
Before you install
Low friction installation with a single runtime dependency (requests). Active maintenance with recent commits and steady development history since 2019-04-26.
License in practice
Licensed under GPLv3 (copyleft). Any derivative work or modification must also be released under GPLv3; redistribution requires source code availability.
Quickstart
pip install mlb-statsapi
import statsapi
# Fetch game data
games = statsapi.schedule(start_date='2025-04-04', end_date='2025-04-04')
Verify before relying
- Whether the package supports querying historical data beyond the current season
- Rate limiting or throttling behavior when making repeated API calls
- Specific Python version compatibility (requires_python is unspecified)
Package facts
| License | not declared (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — requests |
| Maintenance | actively maintained — 497 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 137,837/month — #11,354 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mlb_statsapi-1.9.0-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
nba_apinba_api provides Python access to NBA.com's…
permissive · top 15,000 on PyPI
pybaseballScrapes baseball data from Baseball Reference,…
permissive · top 15,000 on PyPI
pypistatsQueries the PyPI Stats API to retrieve download…
permissive · top 15,000 on PyPI
espn-apiExtracts league, team, and player data from…
permissive · top 15,000 on PyPI
nflreadpyDownloads and caches NFL data from nflverse…
permissive · top 15,000 on PyPI
nfl-data-pyImports NFL play-by-play, weekly, seasonal,…
permissive · top 15,000 on PyPI
statsbombpyStreams StatsBomb football analytics data into…
unclear · top 15,000 on PyPI
runstatsComputes summary statistics (mean, variance,…
permissive · top 15,000 on PyPI
spotapiSpotAPI wraps Spotify's private and public APIs…
unclear · top 15,000 on PyPI
mattermostwrapperA Python wrapper for the Mattermost v4 API that…
permissive · top 15,000 on PyPI