toddrob99 / MLB-StatsAPI

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

player_stats_data throws KeyError when Debut Date not returned by statsapi.mlb.com #49

Closed mycarda closed 4 years ago

mycarda commented 4 years ago

Steps to recreate: call statsapi.player_stat_data( 592622, group="hitting", type="season") for player Mark Payton with id 592622 Data can be seen directly at https://statsapi.mlb.com/api/v1/people/592622?hydrate=stats(group=hitting,type=season),currentTeam

Expected result: Data returned

Actual result: File "/home/mycarda/.local/lib/python2.7/site-packages/statsapi/init.py", line 1123, in player_stat_data "mlb_debut": r["people"][0]["mlbDebutDate"], KeyError: 'mlbDebutDate'

toddrob99 commented 4 years ago

Fixed in v1.0.1

python -m pip install --upgrade mlb-statsapi

Thank you

mycarda commented 4 years ago

I did not expect a fix that quickly. Just upgraded to v1.0.1 and the fix works perfectly. Thank you.