statsbomb / statsbombpy

Easily stream StatsBomb data into Python
566 stars 78 forks source link

Issue report - 404 Client Error #60

Open K1K1K1Zhang opened 9 months ago

K1K1K1Zhang commented 9 months ago

Contact Details

No response

Version

1.0.1

What platform are you seeing the problem on?

Windows

What Python version are you running, are you using a virtual environment? Give us as much info as you can.

Python 3.11

What happened?

After installing the 'statsbombpy' package, I successfully loaded the data of competitions just as you showed. However, when looking for data in matches and lineups, I came across with this error:

微信图片_20240130152939

Is the link invaild?

Relevant log output

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_119264\326908906.py in <module>
----> 1 sb.matches(competition_id=9, season_id=42)

D:\Software\Anaconda\lib\site-packages\statsbombpy\sb.py in matches(competition_id, season_id, fmt, creds)
     29         matches = api_client.matches(competition_id, season_id, creds=creds)
     30     else:
---> 31         matches = public.matches(competition_id, season_id)
     32     if fmt == "dataframe":
     33         home_managers = [

D:\Software\Anaconda\lib\site-packages\statsbombpy\public.py in matches(competition_id, season_id)
     22         competition_id=competition_id, season_id=season_id
     23     )
---> 24     matches = get_response(path)
     25     matches = ents.matches(matches)
     26     return matches

D:\Software\Anaconda\lib\site-packages\statsbombpy\public.py in get_response(path)
      7 def get_response(path):
      8     response = req.get(path)
----> 9     response.raise_for_status()
     10     data = response.json()
     11     return data

D:\Software\Anaconda\lib\site-packages\requests\models.py in raise_for_status(self)
   1019 
   1020         if http_error_msg:
-> 1021             raise HTTPError(http_error_msg, response=self)
   1022 
   1023     def close(self):

HTTPError: 404 Client Error: Not Found for url: https://raw.githubusercontent.com/statsbomb/open-data/master/data/matches/9/42.json

Code to reproduce issue

No response

Attempted solutions

No response

WillTGM commented 9 months ago

Hi,

That competition isn't available via the public open data I'm afraid.

You can try a different combination e.g. sb.matches(competition_id=9, season_id=27) which should be available. You can view the competitions available from the open-data here or via sb.competitions().

We're going to add something to make this more explicit for future reference.

Thanks.