python-mlb-statsapi
python-mlb-statsapi copied to clipboard
TypeError: Player.__init__() got an unexpected keyword argument 'note'
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'"
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
Created a PR for my issue above ^ @seanhe43
Thanks for the Issue! Ill take a look trying to reproduce this and if so look over your PR, thanks @sharmaakhil100 and @seanhe43
This issue should be resolved and handled correctly. Please let me know if it continues.