toddrob99 / MLB-StatsAPI

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

Fix Schedule Bug #130

Closed elliottevans closed 3 months ago

elliottevans commented 9 months ago

Updates:

image

The behavior appears to be stochastic, only occasionally resulting in a clean response from the MLB API.

However, removing game(content(media(epg))) entirely from the hydrate parameter appears to fix this issue.

elliottevans commented 8 months ago

@toddrob99 for viz

toddrob99 commented 7 months ago

@elliottevans, does the error only happen when you use a large date range? It appears the API is returning a 500 Internal Server Error when its query times out. Postman won't show me the response size with the game(content(media(epg))) included for all of 2019 because it says it's too big, but even without the game(content(media(epg))) hydration, the response for all of 2019 is 20MB. For March 2019, the response is 2.63MB without the game(content(media(epg))) hydration and 4.65MB with it. The response for the first half of 2019 is 46MB with the hydration included and 11MB without it.

I'm sure removing the hydration makes the query complete faster because it's joining fewer tables. However, removing the hydration would be a breaking change for anyone expecting the media data to be included.

Instead, I suggest reducing the date range in your requests so they can complete in a timely manner.