mirror of
https://github.com/probberechts/soccerdata.git
synced 2026-04-26 02:25:51 +03:00
[GH-ISSUE #879] [FBref] 403 Forbidden error #187
Labels
No labels
ESPN
FBref
FotMob
MatchHistory
SoFIFA
Sofascore
WhoScored
WhoScored
bug
build
common
dependencies
discussion
documentation
duplicate
enhancement
good first issue
invalid
performance
pull-request
question
question
removal
understat
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/soccerdata#187
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MikeTrusky on GitHub (Aug 23, 2025).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/879
Describe the bug
A call to sd.FBref results with "HTTPError: 403 Client Error: Forbidden".
Affected scrapers
This affects the following scrapers:
Code example
Error message
@probberechts commented on GitHub (Aug 23, 2025):
It looks like FBref now checks for the Sec-CH-UA request header. The following seems to work for me:
(what you send as the header's value does not seem to matter)
@MikeTrusky commented on GitHub (Aug 23, 2025):
Great, I can confirm that without "sec-ch-ua" AssertionError is called, but with this header there is no assert call. So it seems to work. But, is it possible to add this header using soccerdata or there has to be change in fbref.py?
@gustavoalikan1910 commented on GitHub (Aug 24, 2025):
Hello, I found a fix for the error:
I needed to create the header parameter, adding sec-ch-ua in the BaseRequestsReader Class.
I gonna let the code here:
------------------------------------------------------
class BaseRequestsReader(BaseReader):
"""Base class for readers that use the Python requests module."""
Now, Fbref is working good!
@ozzyman703 commented on GitHub (Aug 25, 2025):
I just tried this and got the below error message. Bit of a noob to not sure if I might be doing something wrong - any suggestions much appreciated!
AssertionError Traceback (most recent call last)
/tmp/ipython-input-1561495402.py in <cell line: 0>()
13
14 res = tls_requests.get(url, headers=headers)
---> 15 assert res.status_code == 200
AssertionError:
@mhd0528 commented on GitHub (Oct 4, 2025):
I still get the 403 error even with the header...May I ask what's the time limit for accessing FBref now? Also any other possible solutions?
@keroloshany47 commented on GitHub (Dec 8, 2025):
i still face the same error for now does any one find a solution