Skip to content

[fbref] Error fetching schedule on 1.8.8 #916

@fpldatalyx

Description

@fpldatalyx

Describe the bug
A call to fbref schedule fails with 403 error , even with 1.8.8 version

Affected scrapers
This affects the following scrapers:

  • ClubElo
  • ESPN
  • FBref
  • FiveThirtyEight
  • FotMob
  • Match History
  • SoFIFA
  • Understat
  • WhoScored

Code example
A minimal code example that fails. Use no_cache=True to make sure an invalid cached file does not cause the bug and make sure you have the latest version of soccerdata installed.

import soccerdata as sd
print("Initializing FBref session with caching...")
fbref = sd.FBref(
    leagues="ENG-Premier League",
    seasons=2526,
    no_cache=False,
    no_store=False
)

print("Fetching EPL schedule...⬇️")
schedule = fbref.read_schedule()
schedule_df = schedule.reset_index()

Error message

⏩⏱️ FBref fetch starting...
Initializing FBref session with caching...
                    INFO     Saving cached data to                              _common.py:249
                             /Users/joe/soccerdata/data/FBref                        
[2026-01-18 21:36:44] INFO     TLSLibrary:_load_library:401 - Successfully loaded TLS library: /Users/joe/Documents/GitHub/fplstatshub/.venv/lib/python3.12/site-packages/tls_requests/bin/tls-client-darwin-arm64-1.13.1.dylib
                    INFO     Successfully loaded TLS library:                 libraries.py:401
                             /Users/joe/Documents/GitHub/fplstatshub                 
                             /.venv/lib/python3.12/site-packages/tls_requests                 
                             /bin/tls-client-darwin-arm64-1.13.1.dylib                        
Fetching EPL schedule...⬇️
[01/18/26 21:36:52] ERROR    Error while scraping https://fbref.com/en/comps/.  _common.py:526
                             Retrying... (attempt 1 of 5).                                    
                             Traceback (most recent call last):                               
                               File                                                           
                             "/Users/joe/Documents/GitHub/fplstatshub/               
                             .venv/lib/python3.12/site-packages/soccerdata/_com               
                             mon.py", line 506, in _download_and_save                         
                                 response.raise_for_status()                                  
                               File                                                           
                             "/Users/joe/Documents/GitHub/fplstatshub/               
                             .venv/lib/python3.12/site-packages/tls_requests/mo               
                             dels/response.py", line 194, in raise_for_status                 
                                 raise HTTPError(                                             
                             tls_requests.exceptions.HTTPError: 403 Client                    
                             Error: Forbidden for url:                                        
                             https://fbref.com/en/comps/               

Additional context
Add any other context about the problem here.

Contributor Action Plan

  • I can fix this issue and will submit a pull request.
  • I’m unsure how to fix this, but I'm willing to work on it with guidance.
  • I’m not able to fix this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FBrefIssue or pull request related to the FBref scraperbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions