crawlora-mlb — MLB API client for Python
Python client for Crawlora's hosted MLB API. It exposes 66 API endpoints covering game schedules and details, box scores, standings, player and team statistics, news, and league discovery. Requests go to Crawlora; the package does not run a browser or scrape
MLB locally. A Crawlora account and CRAWLORA_API_KEY are required,
and API use is billed under your Crawlora account. Crawlora is independent from and not endorsed by
MLB or its owners.
Install
python -m pip install crawlora-mlb
Get an API key
Create an account at crawlora.net, then open the Crawlora console for API-key setup. Set your key in the shell before running the client:
export CRAWLORA_API_KEY="your-crawlora-api-key"
Use
Save this example as example.py, then run python example.py after installing the package and setting your API key.
import os
from crawlora_mlb import MLBClient
api_key = os.environ.get("CRAWLORA_API_KEY")
if not api_key:
raise RuntimeError("Set CRAWLORA_API_KEY before running this example.")
with MLBClient(api_key=api_key) as client:
result_1 = client.discovery()
print(result_1)
result_2 = client.editorial_feed(slug='mlb')
print(result_2)
The package also exports Client as an alias for MLBClient. Operation
methods are available directly in snake_case and through the mlb
group. The async package client is AsyncMLBClient; see the online
endpoint and parameter reference and runnable example.
Async usage
The package also exports AsyncClient for asynchronous requests:
import asyncio
import os
from crawlora_mlb import AsyncClient
async def main():
api_key = os.environ.get("CRAWLORA_API_KEY")
if not api_key:
raise RuntimeError("Set CRAWLORA_API_KEY before running this example.")
async with AsyncClient(api_key=api_key) as client:
result_1 = await client.discovery()
print(result_1)
asyncio.run(main())
See the runnable example for a complete usage example.
Supported MLB API endpoints
This package exposes every route below through direct snake_case methods and the mlb group. See the endpoint and parameter reference for complete input details.
| Method | Endpoint | API operation | Description |
|---|---|---|---|
GET |
/mlb/discovery |
mlb-discovery |
Discover MLB sections and Stats API values |
GET |
/mlb/editorial-feed |
mlb-editorial-feed |
Get an MLB.com editorial feed |
GET |
/mlb/game |
mlb-game |
Get an MLB game feed |
GET |
/mlb/game-boxscore |
mlb-game-boxscore |
Get an MLB player boxscore |
GET |
/mlb/game-play-by-play |
mlb-game-play-by-play |
Get MLB game play-by-play |
GET |
/mlb/league-leaders |
mlb-league-leaders |
Get MLB league leaders |
GET |
/mlb/league-stats |
mlb-league-stats |
Get ranked MLB league statistics |
GET |
/mlb/player |
mlb-player |
Get an MLB player |
GET |
/mlb/player-stats |
mlb-player-stats |
Get MLB player season statistics |
GET |
/mlb/prospect-rankings |
mlb-prospect-rankings |
Get MLB Pipeline curated prospect rankings |
GET |
/mlb/prospect-stats |
mlb-prospect-stats |
Get MLB Pipeline prospect statistics and rankings |
GET |
/mlb/schedule |
mlb-schedule |
Get the MLB schedule and scores |
GET |
/mlb/search |
mlb-search |
Search MLB players, teams, and content topics |
GET |
/mlb/standings |
mlb-standings |
Get MLB standings |
GET |
/mlb/statcast-abs-challenges |
mlb-statcast-abs-challenges |
Get Baseball Savant ABS challenge rankings |
GET |
/mlb/statcast-active-spin |
mlb-statcast-active-spin |
Get Baseball Savant Active Spin rows |
GET |
/mlb/statcast-arm-angle |
mlb-statcast-arm-angle |
Get Baseball Savant Pitcher Arm Angle rows |
GET |
/mlb/statcast-arm-strength |
mlb-statcast-arm-strength |
Get Baseball Savant Arm Strength leaderboard data |
GET |
/mlb/statcast-arm-strength-player |
mlb-statcast-arm-strength-player |
Get Baseball Savant player throw details |
GET |
/mlb/statcast-arm-value |
mlb-statcast-arm-value |
Get Baseball Savant Extra Bases Run Value leaderboard data |
GET |
/mlb/statcast-arm-value-details |
mlb-statcast-arm-value-details |
Get expanded Baseball Savant Arm Value player plays |
GET |
/mlb/statcast-baserunning |
mlb-statcast-baserunning |
Get Baseball Savant baserunning leaderboard tables |
GET |
/mlb/statcast-bat-tracking |
mlb-statcast-bat-tracking |
Get Baseball Savant bat-tracking rows |
GET |
/mlb/statcast-batted-ball |
mlb-statcast-batted-ball |
Get Baseball Savant Batted Ball Profile rows |
GET |
/mlb/statcast-birthday-index |
mlb-statcast-birthday-index |
Get Baseball Savant Sarah Langs Birthday Index rows |
GET |
/mlb/statcast-catcher-blocking |
mlb-statcast-catcher-blocking |
Get Baseball Savant Catcher Blocking leaderboard rows |
GET |
/mlb/statcast-catcher-blocking-details |
mlb-statcast-catcher-blocking-details |
Get Baseball Savant Catcher Blocking play details |
GET |
/mlb/statcast-catcher-framing |
mlb-statcast-catcher-framing |
Get Baseball Savant Catcher Framing leaderboard rows |
GET |
/mlb/statcast-catcher-framing-details |
mlb-statcast-catcher-framing-details |
Get Baseball Savant Catcher Framing pitch-event details |
GET |
/mlb/statcast-catcher-pop-time |
mlb-statcast-catcher-pop-time |
Get Baseball Savant Catcher Pop Time leaderboard |
GET |
/mlb/statcast-catcher-stance |
mlb-statcast-catcher-stance |
Get Baseball Savant Catcher Stance rows |
GET |
/mlb/statcast-catcher-throwing |
mlb-statcast-catcher-throwing |
Get Baseball Savant Catcher Throwing leaderboard rows |
GET |
/mlb/statcast-catcher-throwing-details |
mlb-statcast-catcher-throwing-details |
Get Catcher Throwing attempt details |
GET |
/mlb/statcast-expected |
mlb-statcast-expected |
Get Baseball Savant Expected Statistics |
GET |
/mlb/statcast-fielding-run-value |
mlb-statcast-fielding-run-value |
Get Baseball Savant Fielding Run Value rows |
GET |
/mlb/statcast-first-base-receiving |
mlb-statcast-first-base-receiving |
Get Baseball Savant First Base Receiving leaderboards |
GET |
/mlb/statcast-first-base-receiving-details |
mlb-statcast-first-base-receiving-details |
Get a player's First Base Receiving play records |
GET |
/mlb/statcast-home-runs |
mlb-statcast-home-runs |
Get Baseball Savant Home Runs Tracking |
GET |
/mlb/statcast-home-runs-details |
mlb-statcast-home-runs-details |
Get Baseball Savant Home Runs play details |
GET |
/mlb/statcast-leaders |
mlb-statcast |
Get Baseball Savant Statcast leaderboard data |
GET |
/mlb/statcast-oaa |
mlb-statcast-oaa |
Get Baseball Savant Outs Above Average |
GET |
/mlb/statcast-park-factors |
mlb-statcast-park-factors |
Get Baseball Savant Statcast Park Factors rows |
GET |
/mlb/statcast-percentile |
mlb-statcast-percentile |
Get Baseball Savant Percentile Rankings |
GET |
/mlb/statcast-pitch-arsenal |
mlb-statcast-pitch-arsenal |
Get Baseball Savant Pitch Arsenal Stats |
GET |
/mlb/statcast-pitch-arsenal-details |
mlb-statcast-pitch-arsenal-details |
Get Baseball Savant Pitch Arsenal play details |
GET |
/mlb/statcast-pitch-arsenals |
mlb-statcast-pitch-arsenals |
Get Baseball Savant Pitch Arsenals |
GET |
/mlb/statcast-pitch-movement |
mlb-statcast-pitch-movement |
Get Baseball Savant Pitch Movement rows |
GET |
/mlb/statcast-pitch-tempo |
mlb-statcast-pitch-tempo |
Get Baseball Savant Pitch Tempo rows |
GET |
/mlb/statcast-pitch-tempo-player |
mlb-statcast-pitch-tempo-player |
Get a player's Pitch Tempo detail rows |
GET |
/mlb/statcast-pitch-timer |
mlb-statcast-pitch-timer |
Get Baseball Savant Pitch Timer infraction rows |
GET |
/mlb/statcast-player-details |
mlb-statcast-player-details |
Get expanded standard Baseball Savant Statcast player plays |
GET |
/mlb/statcast-rolling |
mlb-statcast-rolling |
Get Baseball Savant Rolling Windows rows |
GET |
/mlb/statcast-run-value |
mlb-statcast-run-value |
Get Baseball Savant Run Value rows |
GET |
/mlb/statcast-running-game |
mlb-statcast-running-game |
Get Baseball Savant Running Game leaderboards |
GET |
/mlb/statcast-running-game-details |
mlb-statcast-running-game-details |
Get Baseball Savant Running Game play details |
GET |
/mlb/statcast-sprint-speed |
mlb-statcast-sprint-speed |
Get Baseball Savant Sprint Speed player rows |
GET |
/mlb/statcast-sprint-speed-teams |
mlb-statcast-sprint-speed-teams |
Get Baseball Savant Sprint Speed team rows |
GET |
/mlb/statcast-swing-path |
mlb-statcast-swing-path |
Get Baseball Savant Swing Path and Attack Angle rows |
GET |
/mlb/statcast-swing-timing |
mlb-statcast-swing-timing |
Get Baseball Savant Swing Timing and Miss Distance rows |
GET |
/mlb/statcast-swing-timing-details |
mlb-statcast-swing-timing-details |
Get Baseball Savant Swing Timing player details |
GET |
/mlb/statcast-top-performers |
mlb-statcast-top-performers |
Get Baseball Savant Top Performers |
GET |
/mlb/statcast-year-to-year |
mlb-statcast-year-to-year |
Get Baseball Savant Year-to-Year Changes |
GET |
/mlb/team-roster |
mlb-team-roster |
Get an MLB team roster |
GET |
/mlb/team-stats |
mlb-team-stats |
Get MLB team season statistics |
GET |
/mlb/teams |
mlb-teams |
List MLB teams |
GET |
/mlb/transactions |
mlb-transactions |
List MLB transactions |
Configuration
Pass your key through api_key or read CRAWLORA_API_KEY from the environment.
Keep credentials out of source control and logs. Requests go to Crawlora's
hosted API.
Metadata
Release files for crawlora-mlb 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| crawlora_mlb-0.1.0.tar.gz | 87.2 kB | Without provenance | Details for crawlora_mlb-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crawlora_mlb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for crawlora_mlb-0.1.0-py3-none-any.whl |
Total release size: 175.1 kB
Release files / crawlora_mlb-0.1.0.tar.gz
| Download URL | crawlora_mlb-0.1.0.tar.gz |
|---|---|
| Size | 87.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e46d65e162c21cb225225f85ec45ee5167830eed5446051c0e3e9b617b179e83
|
|
BLAKE2b-256 checksum How to use checksums |
0451cbbe9a32cfad051dd5b5d029a6da74e34adf209bb31de80b0d40480ad707
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / crawlora_mlb-0.1.0-py3-none-any.whl
| Download URL | crawlora_mlb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 87.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f36fa63300d9e06906fea1d843afa41b32bc4a6ada02ba0ef802503d694f336
|
|
BLAKE2b-256 checksum How to use checksums |
f3f33b04061bbd301b3cd489beccbbef37ec6139d2023de01048d5e6a96d192d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for crawlora-mlb 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.