zero-sum-seattle / python-mlb-statsapi

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

TypeError: SimplePitchingSplit.__init__() got an unexpected keyword argument 'summary' #214

Closed sertdfyguhi closed 5 months ago

sertdfyguhi commented 5 months ago

I tried running this code to get the game log of a player.

import mlbstatsapi

mlb = mlbstatsapi.Mlb()

print(
    mlb.get_player_stats(
        450203, ["gameLog"], ["pitching"]
    )
)

and it printed this error:

Traceback (most recent call last):
  File "/Users/user/programming/mlb/main.py", line 11, in <module>
    mlb.get_player_stats(
  File "/opt/homebrew/lib/python3.12/site-packages/mlbstatsapi/mlb_api.py", line 2199, in get_player_stats
    splits = mlb_module.create_split_data(mlb_data.data['stats'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/mlbstatsapi/mlb_module.py", line 115, in create_split_data
    split_data = return_splits(stat['splits'], stat_type, stat_group)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/mlbstatsapi/mlb_module.py", line 73, in return_splits
    splits.append(obj(**split))
                  ^^^^^^^^^^^^
  File "<string>", line 19, in __init__
  File "/opt/homebrew/lib/python3.12/site-packages/mlbstatsapi/models/stats/pitching.py", line 562, in __post_init__
    self.stat = SimplePitchingSplit(**self.stat)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: SimplePitchingSplit.__init__() got an unexpected keyword argument 'summary'

Can anyone help me fix this issue? Thanks.

KCNilssen commented 5 months ago

@sertdfyguhi this should fix the missing attribute "summary" in pitching stats. Update to 0.5.22 to get the changes