toddrob99 / MLB-StatsAPI

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

game_scoring_play_data not returning data #44

Closed CaptainMoustache closed 4 years ago

CaptainMoustache commented 4 years ago

The game_scoring_play_data function is not returning any of the expected lists of scoring plays. I checked the response from the mlb api and it doesn't look like the call is returning any plays at all. Maybe the plays from a game have moved somewhere else?

CaptainMoustache commented 4 years ago

This is all thats getting returned from the current call

[{ 'date': '2020-07-25', 'games': [{ 'teams': { 'away': { 'team': { 'name': 'Kansas City Royals' } }, 'home': { 'team': { 'name': 'Cleveland Indians' } } } } ] } ]

toddrob99 commented 4 years ago

It looks like the schedule endpoint is no longer returning data for the scoringplays hydration, despite being listed as an available hydration (include hydrate=hydrations and the endpoint will give a list of available hydrations):

https://statsapi.mlb.com/api/v1/schedule?sportId=1&gamePk=631108&hydrate=hydrations

"hydrations" : [ "team", ..., "linescore", "decisions", "scoringplays", "broadcasts", "broadcasts(all)", "radioBroadcasts", "metadata", "game(seriesSummary)", "seriesStatus", ..., "venue", "weather", "gameInfo", "officials", "probableOfficials" ]

I can switch the game_scoring_play_data() method to pull the data from the game endpoint instead. I liked using the schedule endpoint because it presented the relevant data simply without a lot of extraneous data.

toddrob99 commented 4 years ago

Thank you for bringing this to my attention. Fixed in v0.1.9. py -m pip install --upgrade mlb-statsapi