probberechts / soccerdata

⛏⚽ Scrape soccer data from Club Elo, ESPN, FBref, FiveThirtyEight, Football-Data.co.uk, FotMob, Sofascore, SoFIFA, Understat and WhoScored.
https://soccerdata.readthedocs.io/en/latest/
Other
573 stars 101 forks source link

[FBref] 403 client error #63

Closed clumsycompiler closed 2 years ago

clumsycompiler commented 2 years ago

Steps to recreate the problem:

import soccerdata as sd fbref = sd.FBref(leagues="ENG-Premier League", seasons=2021) team_season_stats = fbref.read_team_season_stats(stat_type="standard") team_season_stats.head()

Error:

[07/18/22 09:33:53] ERROR Error while scraping https://fbref.com/en/comps/. _common.py:349 Retrying... (attempt 1 of 5).
Traceback (most recent call last):
File "/home/dkblu/anaconda3/envs/sportsdata/lib/python3.9/site-packages/soccerdata/_common.py",
line 343, in _download_and_save
return io.BytesIO(response.content)
File "/home/dkblu/anaconda3/envs/sportsdata/lib/python3.9/site-packages/requests/models.py", line 960, in raise_for_status
raise HTTPError(http_error_msg,
response=self)
requests.exceptions.HTTPError: 403 Client Error:
Forbidden for url: https://fbref.com/en/comps/

probberechts commented 2 years ago

This is probably related to #59. Make sure you use v1.0.2. You can check your version with:

import soccerdata as sd
sd.__version__
clumsycompiler commented 2 years ago

upgraded the version, works fine. Thank you