python-mlb-statsapi icon indicating copy to clipboard operation
python-mlb-statsapi copied to clipboard

TypeError: Player.__init__() got an unexpected keyword argument 'note'

Open seanhe43 opened this issue 1 year ago • 2 comments

Looks like the API may have been updated with a new "note" attribute added to some players in the 40 man (mostly injury notes) when doing this call mlb.get_team_roster(121, rosterType = '40Man')

A quick test showed the same for rosterTypes 'fullRoster' and 'allTime' mlb.get_team_roster(121, rosterType = 'allTime') mlb.get_team_roster(121, rosterType = 'fullRoster')

File c:\\Python312\\Lib\\site-packages\\mlbstatsapi\\mlb_api.py:530, in Mlb.get_team_roster(self, team_id, **params)
    528 if 'roster' in mlb_data.data and mlb_data.data['roster']:
    529     for player in mlb_data.data['roster']:
--> 530         players.append(Player(**mlb_module.merge_keys(player, ['person'])))
    532 return players

TypeError: Player.__init__() got an unexpected keyword argument 'note'"

seanhe43 avatar Aug 12 '24 12:08 seanhe43

Yes found a similar issue with

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

Unexpected keyword 'summary' in init type 

Seems like updates to this repo will have to be made to fix it

sharmaakhil100 avatar Aug 12 '24 22:08 sharmaakhil100

Created a PR for my issue above ^ @seanhe43

sharmaakhil100 avatar Aug 12 '24 22:08 sharmaakhil100

Thanks for the Issue! Ill take a look trying to reproduce this and if so look over your PR, thanks @sharmaakhil100 and @seanhe43

KCNilssen avatar Aug 21 '24 16:08 KCNilssen

This issue should be resolved and handled correctly. Please let me know if it continues.

KCNilssen avatar Aug 21 '24 17:08 KCNilssen