toddrob99 / MLB-StatsAPI

Python wrapper for MLB Stats API
GNU General Public License v3.0
539 stars 100 forks source link

[QUESTION] Is it possible to display the innings with the StatsAPI? #106

Closed ABUCKY0 closed 1 year ago

toddrob99 commented 1 year ago

You can find inning data (e.g. to build a linescore) in the game endpoint. You'll find it in the response under game["liveData"]["linescore"].

game = statsapi.get("game", {"gamePk": 719124})
linescore_data = game["liveData"]["linescore"]

If linescore is what you're after, you can also get a formatted linescore using this library's linescore method. You can see how this method retrieves and parses the data here