statsbomb / statsbombpy

Easily stream StatsBomb data into Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue report

DhananjayAshok opened this issue · comments

Contact Details

dhananjay.ashok99@gmail.com

Version

1.0.1

What platform are you seeing the problem on?

Linux

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

Python 3.7.10 using Conda for package management

What happened?

Unable to call on sb.matches

Relevant log output

>>> from statsbombpy import sb
>>> sb.matches(competition_id=9, season_id=42)
/home/dhananjay/miniconda3/lib/python3.7/site-packages/statsbombpy/api_client.py:20: NoAuthWarning: credentials were not supplied. open data access only
  warnings.warn("credentials were not supplied. open data access only", NoAuthWarning)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dhananjay/miniconda3/lib/python3.7/site-packages/statsbombpy/sb.py", line 30, in matches
    matches = public.matches(competition_id, season_id)
  File "/home/dhananjay/miniconda3/lib/python3.7/site-packages/statsbombpy/public.py", line 16, in matches
    competition_id=competition_id, season_id=season_id
  File "/home/dhananjay/miniconda3/lib/python3.7/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/home/dhananjay/miniconda3/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/home/dhananjay/miniconda3/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 4 (char 3)
>>>

Code to reproduce issue

>>> from statsbombpy import sb
>>> sb.matches(competition_id=9, season_id=42)

Attempted solutions

No response

There is a NoAuthWarning there -- you need to provide appropriate credentials to access that league season.

The openly available competition seasons are here: https://github.com/statsbomb/open-data/tree/master/data/matches

The directory structure is {competition_id}/{season_id}, e.g. sb.matches(competition_id=11, season_id=90) will work without credentials.

You can also get a dataframe containing details of the competition seasons available to you via sb.competitions().