A Python wrapper for the MLB Stats API, providing easy access to MLB data including schedules, standings, player stats, and more. Version 1.9.0 is the latest stable release. Updates are frequent, with several releases per year.
pip install mlb-statsapiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Quick example of common operations: schedule, player lookup, and standings.
Use 'import statsapi' in your code.
Upgrade to v1.6.1+ or wrap in try/except.
Upgrade to v1.8.1+ if you need date filtering for stats.
Ensure you pass params as a dict or rely on new default.
Change import to 'import statsapi'.
Check if game is complete before accessing team data, or upgrade to latest version.
Upgrade to mlb-statsapi>=1.9.0.