r/mlbdata 3d ago

Release v1.1.0 · zero-sum-seattle/python-mlb-statsapi

Thumbnail
github.com
2 Upvotes

https://github.com/zero-sum-seattle/python-mlb-statsapi/releases/tag/v1.1.0

Please report any bugs I'll jump on them :)

My DB population script is 3x faster with some simple async additions. I haven't even done anything to optimize the DB either.


r/mlbdata 5d ago

I created bAIseball.org

Thumbnail
0 Upvotes

r/mlbdata 9d ago

Looking for feedback on python-mlb-statsapi v1.1.0 before release

18 Upvotes

Hey guys I maintain python-mlb-statsapi, a Python wrapper for the MLB Stats API, and I’m working on v1.1.0.

The biggest addition is first-class async support with AsyncMlb. I’m also updating and cleaning up the README/docs so the project is easier to understand and use.
Before I release it, I’d really appreciate some outside eyes on it.

There is no ego here. If something about the API feels weird, the async design looks wrong, the docs are confusing, the tests seem excessive, or there’s something I’m overengineering, I want to hear it.

Honestly I’d love to talk about retry logic. I want to make something that works well for us.

I’ve got a real cool project that uses my module coming to show you guys. Async will be awesome for all of us.

GitHub: @Mattsface
Repo:
https://github.com/zero-sum-seattle/python-mlb-statsapi

Send me GitHub names!


r/mlbdata 13d ago

Recreating Ted Williams' Strikezone Plot

Post image
2 Upvotes

r/mlbdata 22d ago

What’s coming in python-mlb-statsapi v1.1.0

8 Upvotes

What’s coming in python-mlb-statsapi v1.1.0

Now that 1.0 is out and I’ve been cleaning up a few bugs, I’ve started planning what I want to tackle in 1.1.0.

The big one is first-class async support.

The goal is to eventually support something like:

from mlbstatsapi import AsyncMlb

async with AsyncMlb() as mlb:
    team = await mlb.get_team(136)

without changing how the existing synchronous Mlb client works.

I don’t want async to become a completely separate implementation either. The plan is for the sync and async clients to share the same models, parsing, exceptions, and endpoint behavior, with separate transport layers underneath.

I’m going to start small with the async adapter and a couple endpoints, get the architecture right, add sync/async parity tests, and then expand endpoint coverage from there.

I also did some pretty rapid development recently with coding agents, which helped me move the project forward quickly, but there are definitely areas I want to go back through and clean up. Some of 1.1.0 will be tightening up the structure, documentation, and anything that feels like it grew too quickly.

I plan to write most of this release myself.

I’ve realized I don’t want to get into the habit of using AI as a button that just writes everything for me. I’m a backend/infrastructure engineer and async Python is something I understand conceptually, but I want a much stronger mental model of what is actually happening underneath it.

I think slowing down a little, cleaning up some of the rapid development, and actually working through the async architecture myself will make both me and the project better.

Should be fun.

Do you guys have any other thoughts? things that should be addressed or improved in future releases?


r/mlbdata 24d ago

python-mlb-statsapi v1.0.0 released

30 Upvotes

I finally pushed v1.0.0 of python-mlb-statsapi.

This release finishes up the HTTP work I started in 0.8 and 0.9 and gives the library a stable public API contract going forward.

The biggest breaking change:

Mlb() now uses strict HTTP handling by default.

In 0.9, strict mode was optional:

mlb = mlbstatsapi.Mlb(strict_http=True)

In 1.0, this is now the default:

mlb = mlbstatsapi.Mlb()

Final non-404 4xx responses now raise MlbHttpError instead of silently returning the historical empty result.

404 behavior is intentionally unchanged. Depending on the endpoint, a 404 can still return None, [], or {}.

If you aren’t ready to migrate yet, the old 0.9 behavior is still available explicitly:

mlb = mlbstatsapi.Mlb(strict_http=False)

That compatibility mode will emit MlbHttpCompatibilityWarning when it suppresses a non-404 4xx response, so you can find places in your code that need to be updated.

A few things that came out of the 0.9 work and remain part of 1.0:

Structured HTTP, timeout, transport, and JSON decode exceptions

More useful context on MlbHttpError
Public create_retry_policy() helper
Shared HTTP sessions with defined ownership/cleanup behavior
Versioned User-Agent
Bounded retries for transient failures
Support for caller-managed requests.Session objects without modifying their configuration

For 1.0 I also went through the public API and documented what I’m actually committing to keeping stable during the 1.x series. That was something I wanted to get right before putting a 1.0 label on the project.

The release process itself got quite a bit more serious too. The package is now tested against Python 3.10 through 3.14, and both the wheel and source distribution are built, clean-installed into isolated environments, and smoke-tested before release.

This project started as a pretty simple Python wrapper around MLB’s Stats API, so getting it to an actual 1.0 release feels pretty cool.

PyPI:

pip install -U python-mlb-statsapi

GitHub:

https://github.com/zero-sum-seattle/python-mlb-statsapi
Full migration notes and the HTTP behavior matrix are in the repo.

As always, bug reports, weird MLB API behavior, and contributions are welcome.


r/mlbdata 24d ago

MLB Logos

1 Upvotes

Hello! I have been exploring the MLB API and I am curious if there is a way to get team logos?


r/mlbdata 26d ago

"Is the MLB Stats API still accessible? Experience with blocks?"

0 Upvotes

Hi everyone, I'm a student learning Python and working on a personal baseball analytics project. I want to integrate the MLB Stats API to pull game data and player statistics.

My question is: is the API still accessible today without restrictions? I've seen some posts mentioning blocks and I want to know if it's still reliable before I build around it.

Any experience or advice would be appreciated. Thanks!


r/mlbdata 28d ago

python-mlb-statsapi 0.9.0: Better HTTP errors and a path to 1.0

7 Upvotes

I’ve been working on version 0.9.0 of my Python MLB Stats API wrapper, and the final release PR is ready for review.

I’ll go through the code again after I finish my shit cashiering shift today. I miss working tech…

Anyway,

This release adds a public retry policy, richer HTTP errors, an optional strict mode, compatibility warnings, and a versioned User-Agent while keeping the existing return behavior as the default.

It also starts preparing users for a possible breaking change in 1.0.0. Right now most non-404 4xx responses return an empty result for compatibility. In 1.0.0, strict HTTP handling may become the default, meaning those responses would raise an actual exception instead.

The project also has a much stronger offline test suite and release validator now.

I’d appreciate any feedback before I merge and publish it.

https://github.com/zero-sum-seattle/python-mlb-statsapi/pull/281


r/mlbdata Aug 02 '26

python-mlb-statsapi v0.8.0 released

26 Upvotes

Title: python-mlb-statsapi v0.8.0 released

I finally pushed version 0.8.0 of python-mlb-statsapi to PyPI.

This release mostly focused on making the HTTP layer more reliable instead of cramming in more endpoints. It adds shared sessions, default timeouts, retries for temporary MLB API failures, clearer exceptions, better testing, and more documentation.

Release notes:

https://github.com/zero-sum-seattle/python-mlb-statsapi/blob/main/docs/releases/0.8.0.md

PyPI:

https://pypi.org/project/python-mlb-statsapi/0.8.0/

For 0.9.0, I’m planning to explore an optional strict HTTP mode, better error information, deprecation warnings, basic request hooks, and a versioned User-Agent. Most of that work lives inside the client, but MLB’s API is undocumented and can be inconsistent, so the final scope will depend on what I can test reliably.

Longer term, I’d like 1.0 to clean up deprecated arguments and make the package’s return and error behavior more consistent. I’m also looking into optional caching, throttling, and possibly an async client, but I don’t want to promise features until I know they behave responsibly with the API.

Those plans may move around a little, but that is the general direction. I am trying to handle this in smaller releases with actual testing and documentation instead of disappearing for another few years.


r/mlbdata Jul 21 '26

An app I built on Reddit's dev platform: mods can add a live, interactive MLB scoreboard to their subreddit - real-time score, box score, play-by-play, and win probability. Set it for all 30 teams or just yours; a final thread auto-posts at game's end with custom win/loss titles. *In Review*

Thumbnail
10 Upvotes

r/mlbdata Jul 14 '26

Statcast Metrics In GameFeed Data

8 Upvotes

I currently have a home application that pulls game data from the "api/v1.1/game/{gamePk}/feed/live" endpoint. I recently noticed that the statcast export from the web page started to include new data like miss_distance, swing_path_tilt, and a few other things. I get some statcast data from that request, things like a(x|y|z}, v(x0|y0|z0), etc. But at the moment I'm not using any hydrations or anything fancy.

Does anyone know of a way to include new statcast data into the game request? It would be nice to get "all" of the data, cache it, and parse out new data as it becomes available.


r/mlbdata Jul 10 '26

Possible data error

3 Upvotes

I'm putting together a spreadsheet that draws data from the MLB API about the team histories of players. Right now I've got it working pretty well, but there's one thing I've found that's not right. The result of my API Call shows that Dillon Dingler played for the Salt River Rafters in the Arizona Fall League in '22.

That's not an issue itself, but the problem is that the parentOrgId is listed as 109 which is the D-backs. Every other Tigers player that has the Rafters in their history lists the correct (Tigers) parentOrgId of 116. So is this just a mistake in the database, or am I interpreting this data incorrectly?

https://statsapi.mlb.com/api/v1/teams/116/roster?rosterType=40Man&hydrate=person(rosterEntries)


r/mlbdata Jul 01 '26

Sabermetrics Discord Server

4 Upvotes

For those interested in having real-time discussions, I've recently created a Sabermetrics Discord server:

https://discord.gg/j9CAVRCAsK

I'm a software developer by trade and am looking for other baseball and stats nerds to have fun discussing tools you're building, analytics, and interesting findings.

Come join me!


r/mlbdata Jun 21 '26

Player who gets picked off the most?

1 Upvotes

Hi friends, I remember early in the year when I saw a stat that said Lawrence Butler led the league as the player who gets picked off the most. I’ve been able to find players’ caught stealing stats most everywhere, but I can’t find a way to get a leaderboard of baserunners who get picked off most often. Anyone able to offer assistance? It would be highly appreciated


r/mlbdata Jun 18 '26

I turned my childhood habit of hand logging ever MLB home run into an app

Post image
13 Upvotes

Ever since I was about 8 years old I’ve kept a manual ledger of every MLB Homer. It’s obviously silly and unnecessary, but as I’ve gotten older realized that it in a way was a strange baseball mindfulness exercise that grounded my mind.

Last year I turned it into an app where you have to manually tap and “acknowledge” the home run from every box score. Since then I’ve been building and building on it, and basically turned it into a personal replacement for the MLB app.

Realized in the last couple weeks that it was becoming pretty polished and that I’ve spent way too much time working on this for it to just be something me and a couple friends use. So I’m here now asking for you all to check it out and tell me what you think!

It’s a PWA mobile app that can be found at this link: Mentaculus.app

Would love to get some feedback on this, so please if you have any time take a look and comment down below!

Was built mostly on MLB stats api with some additional sourcing from the Chadwick ID database, Fangraphs, Baseball Reference, and with lots of assistance from pybaseball.


r/mlbdata Jun 17 '26

MLB api started blocking me?

11 Upvotes

For the past 10 years, I've been using the MLB api to grab last night's box scores and then join the data to my fantasy league's rosters so all of my league members can quickly see how their players performed last night. This morning I noticed the results were empty and when i explored, i saw my script still worked fine on my laptop but was returning a 406 error when run from my server. So I decided to write a more careful script using a headless browser , and same thing - this yielded the message: " "Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.Wed Jun 17 19:04:43 UTC 2026There was an unexpected error (type=Not Acceptable, status=406)."" Does anybody know what changed? Is it possible that mlb is blocking all traffic from my hosting company? The url i'm trying to grab works just fine when i call it from my laptop script and browser: https://statsapi.mlb.com/api/v1/schedule?sportId=1&season=2026&date=06%2F16%2F2026


r/mlbdata Jun 18 '26

I’m trying to build a good baseball score app similar to FotMob, am I not able to use the MLB API?

1 Upvotes

I’ve been working for some time on trying to build an app similar to FotMob for baseball, having live baseball scores for leagues across the globe. Today the server I host the backend on to make the API calls to the MLB Stats API got blocked, I get nonstop 406 errors.

Over the course of debugging I discovered in the GET requests this statement:

> The accounts, descriptions, data and presention in the referring page (the "Materials") are proprietary content of MLB Advanced Media, L.P ("MLBAM"). Only individual, non-commercial, non-bulk use of the Materials is permitted and any other use of the Materials is prohibited without prior written authorization from MLBAM. Authorized users of the Materials are prohibited from using the Materials in any commercial manner other than as expressly authorized by MLBAM.

To me this reads like unless I get express authorization from MLB, I can’t use the API for bulk use (aka an app for others to use).

I’m not a lawyer and this was a fun personal project I was doing for free, so I’m in no spot to drop money to consult an attorney. I can’t imagine if I email MLB they’ll just give me written authorization, and even if they did I can’t imagine that I’ll be able to get around this 406 errors anyways.

Is my project dead in the water?


r/mlbdata Jun 14 '26

In game mascot races

3 Upvotes

Does anyone know of a good way to scrape data/info on mascot race results? I have a relatively functioning desktop scoreboard thing going on and my mom asked me if it showed the results of the salmon run (Mariners fan) and now I’m determined to add this info. Would be cool if I could get data from not just Mariners shit (brewers,nationals,Mets etc.) but that’s not actually important for me


r/mlbdata May 25 '26

Built a simple dashboard for finding the best line on all MLB props

4 Upvotes

All of the other line shopping tools are so hard to use so I built a super simple one. You can filter by prop, book, or player. It basically has every relevant book and bet. Totally free. Would love for people to check it out. Updates every 30 seconds and throughout the game.
https://www.parlaysavant.com/props?sport=mlb


r/mlbdata May 22 '26

FFDB, my local Statcast database, is now on GitHub [x-post r/Sabermetrics]

Thumbnail
4 Upvotes

r/mlbdata May 22 '26

Need a new mobile workstation for Data Science! Any Recommendations or Specs?

3 Upvotes

Price Range is max 3000$. Thank you for the help. Also I have begun a markerless mocap project to assess pitch type and recreate pitches recorded by cameras 1:1 off a standard machine using the given data insights. Thank you for the help


r/mlbdata May 20 '26

Opinions on my stats explorer for games you’ve seen

Thumbnail
gallery
0 Upvotes

I created an app where you can log games you attend, including metrics about your experience at the game like how many hot dogs you ate, or how many times you wore a rally cap. I just added a new feature that lets you visualize these stats, and see the relation of your favorite team or player’s performance to the amount of hot dogs you ate. I’d love some opinions so here are some photos, or you can check it out online or in the app


r/mlbdata May 16 '26

Salary Data and Statistics

1 Upvotes

Hey everyone, I am working on a project for an analytics class and I have been trying to find a site where I can export a player list of a certain amount of players that includes their salary along with their statistics (does not have to be extremely advanced) but I have had trouble finding one set that includes both salary and stats. Is there anything out there that may be able to help? Or is my best bet to pull a list of players and salaries and add the statistics that I want to see myself? Thanks :)


r/mlbdata May 14 '26

I got curious to see how calls at the plate relate to win%. I used Savant to get data for called strikes outside the strike zone and balls called that were inside the zone. I compiled and ranked for batter/pitcher and home/away.

5 Upvotes

It's clear some teams are catching favorable calls and some aren't on both sides. How it relates to winning is mixed. There are teams losing despite getting gifts and vice versa. So go easy on the umps if your team is getting hosed at the plate.