zero-sum-seattle / python-mlb-statsapi

Python Wrapper for the MLB's Official Stats API
MIT License
48 stars 11 forks source link

Update hitting.py to fix unexpected keyword errors #219

Closed sharmaakhil100 closed 3 months ago

sharmaakhil100 commented 3 months ago

Why

Running this code with 'gameLog', which is a valid stat input was giving an unexpected keyword summary exception:

    stats = ['gameLog']
    groups = ['hitting']
    params = {'season': 2024}
    all_game_stats = mlb.get_player_stats(664034, stats, groups, **params)

What

Changes were made to ignore unexpected keywords instead of throwing an error

Tests

Tested with original library code calls and now it is working

KCNilssen commented 3 months ago

@sharmaakhil100 thank you for giving it a go at trying to resolve the issue but to fix the error by just ignoring it is not in the best interest of the repo. We would prefer we handle it so that as the MLB api grows and adapts so does our wrapper and not just ignoring and limiting access to new variables. Im going to close this and submit a new PR showing how we would like the library to handle things like this, I suggest giving that a look over and applying it next time. I would love to approve your work in the future!

sharmaakhil100 commented 3 months ago

@KCNilssen completely understand! Thank you for closing it and and going with this approach, helps me learn as a newer developer and get a working library :D