[GH-ISSUE #890] [SoFifa] 403 Forbidden errorbugSomething isn't working SoFifa #191

Closed
opened 2026-03-02 15:56:33 +03:00 by kerem · 1 comment
Owner

Originally created by @MatteoSSL on GitHub (Oct 15, 2025).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/890

403 HTTP Error while instancing the SOFIFA Scraper.

import soccerdata as sd

# Create scraper class instance
sofifa = sd.SoFIFA(leagues="ENG-Premier League", versions="latest")#no_store
print(sofifa.__doc__)

Error message

Error while scraping https://sofifa.com. Retrying... (attempt 2 of 5).  [_common.py](file:///home/smartb/anaconda3/lib/python3.9/site-packages/soccerdata/_common.py):[545](file:///home/smartb/anaconda3/lib/python3.9/site-packages/soccerdata/_common.py#545)
                             Traceback (most recent call last):                                                    
                               File                                                                                
                             "/home/smartb/anaconda3/lib/python3.9/site-packages/soccerdata/_common.               
                             py", line 525, in _download_and_save                                                  
                                 response.raise_for_status()                                                       
                               File                                                                                
                             "/home/smartb/anaconda3/lib/python3.9/site-packages/requests/models.py"               
                             , line 1024, in raise_for_status                                                      
                                 raise HTTPError(http_error_msg, response=self)                                    
                             requests.exceptions.HTTPError: 403 Client Error: Forbidden for url:                   
                             https://sofifa.com/

Contributor Action Plan

  • I can fix this issue and will submit a pull request.
  • [x ] 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.
Originally created by @MatteoSSL on GitHub (Oct 15, 2025). Original GitHub issue: https://github.com/probberechts/soccerdata/issues/890 403 HTTP Error while instancing the SOFIFA Scraper. ```python import soccerdata as sd # Create scraper class instance sofifa = sd.SoFIFA(leagues="ENG-Premier League", versions="latest")#no_store print(sofifa.__doc__) ``` **Error message** ``` Error while scraping https://sofifa.com. Retrying... (attempt 2 of 5). [_common.py](file:///home/smartb/anaconda3/lib/python3.9/site-packages/soccerdata/_common.py):[545](file:///home/smartb/anaconda3/lib/python3.9/site-packages/soccerdata/_common.py#545) Traceback (most recent call last): File "/home/smartb/anaconda3/lib/python3.9/site-packages/soccerdata/_common. py", line 525, in _download_and_save response.raise_for_status() File "/home/smartb/anaconda3/lib/python3.9/site-packages/requests/models.py" , line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://sofifa.com/ ``` **Contributor Action Plan** - [ ] I can fix this issue and will submit a pull request. - [x ] 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.
kerem 2026-03-02 15:56:33 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@MatteoSSL commented on GitHub (Oct 15, 2025):

I've fix it, as suggested by @gustavoalikan1910 in the https://github.com/probberechts/soccerdata/issues/879:

headers = {
"sec-ch-ua": '"Not A Brand";v="99", "Chromium";v="138", "Google Chrome";v="138"'
}

    """Download file at url to filepath. Overwrites if filepath exists."""
    for i in range(5):
        try:
            response = self._session.get(url, headers=headers)
            #response = self._session.get(url)

in the _download_and_save method of the clss BaseRequestsReader(BaseReader).

<!-- gh-comment-id:3405817832 --> @MatteoSSL commented on GitHub (Oct 15, 2025): I've fix it, as suggested by @gustavoalikan1910 in the https://github.com/probberechts/soccerdata/issues/879: headers = { "sec-ch-ua": '"Not A Brand";v="99", "Chromium";v="138", "Google Chrome";v="138"' } """Download file at url to filepath. Overwrites if filepath exists.""" for i in range(5): try: response = self._session.get(url, headers=headers) #response = self._session.get(url) in the _download_and_save method of the clss BaseRequestsReader(BaseReader).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/soccerdata#191
No description provided.