toddrob99 / MLB-StatsAPI

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

v1.6 #97

Closed toddrob99 closed 1 year ago

toddrob99 commented 1 year ago

Enh: Add series_status to schedule #95 (thanks @WardBrian) Fix: Error in schedule method when team score or name are missing #96

toddrob99 commented 1 year ago

@WardBrian, FYI...

During my testing I found that the seriesStatus hydration causes an error for 2014-03-11. All other dates since 2000 work fine.

https://statsapi.mlb.com/api/v1/schedule?startDate=2014-03-11&endDate=2014-03-11&sportId=1&hydrate=seriesStatus

I scanned all the games on that day (by removing the seriesStatus hydration), and they all seem to have series info in the standard response. I have no idea why the error is happening.

I added logic to exclude the seriesStatus hydration if 2014-03-11 is in the date range for the schedule method. I don't really like it, but the schedule method needs to work for all dates and there doesn't seem to be a better option.

WardBrian commented 1 year ago

Wow, that’s a weird one. Good catch though!

toddrob99 commented 1 year ago

Wow, that’s a weird one. Good catch though!

We'll just have to be on the lookout for server errors starting in the future, and if that happens we'll probably have to remove the seriesStatus hydration and/or only include it based on a new parameter. I'm going to think about this for a little while--it may be best to make it optional and not included by default now. What do you think?

WardBrian commented 1 year ago

I wouldn't be too worried until there is a second example of it going haywire, at which point I think putting it behind a new parameter would make sense