[GH-ISSUE #780] [FotMob] Failed to establish new connection #165

Closed
opened 2026-03-02 15:56:19 +03:00 by kerem · 0 comments
Owner

Originally created by @tobias199822 on GitHub (Jan 6, 2025).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/780

Describe the bug
I want to scrape soccer data and my scraping code, that works for months, doesn't work now.

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 json
import os
import pyodbc
from class_Match import Match
from soccerdata import FotMob
from soccerdata import fbref as sd
import pandas as pd
from pathlib import Path
from openpyxl import load_workbook

pd.set_option('display.max_columns', None)

# Setze die Parameter für den Tor-Proxy
tor_proxy = {
    'http': 'socks5h://localhost:9150',
    'https': 'socks5h://localhost:9150'
}

path = Path('C:/Users/tobia/soccerdata/data/FotMob/matches/Bundesliga')

# Erstelle eine Instanz von FotMob und verwende den Tor-Proxy
fotmob = FotMob(leagues='GER-Bundesliga', seasons=[23, 24, 25], proxy=tor_proxy, data_dir= path)
match_stats = fotmob.read_team_match_stats(stat_type='Top stats', team=None)
#print(FotMob.available_leagues())

Error message

Traceback (most recent call last):
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 198, in _new_conn
sock = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
raise err
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 793, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request
conn.request(
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 400, in request
self.endheaders()
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1314, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1074, in _send_output
self.send(msg)
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1018, in send
self.connect()
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 238, in connect
self.sock = self._new_conn()
^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 213, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000002B3B0517290>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 847, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='46.101.91.154', port=6006): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002B3B0517290>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\soccerdata\fotmob.py", line 85, in _init_session
r = requests.get("http://46.101.91.154:6006/")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='46.101.91.154', port=6006): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002B3B0517290>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\tobia\OneDrive\Dokumente\Steuern_allgemein\Python_Projekte\API_Soccerdata\Bundesliga_FotMob2SQLSERVER.py", line 22, in
fotmob = FotMob(leagues='GER-Bundesliga', seasons=[23, 24, 25], proxy=tor_proxy, data_dir= path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\soccerdata\fotmob.py", line 69, in init
super().init(
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\soccerdata_common.py", line 505, in init
self._session = self._init_session()
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\soccerdata\fotmob.py", line 88, in _init_session
raise ConnectionError("Unable to connect to the session cookie server.")
ConnectionError: Unable to connect to the session cookie server.```


**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.
- [x] I’m not able to fix this issue.
Originally created by @tobias199822 on GitHub (Jan 6, 2025). Original GitHub issue: https://github.com/probberechts/soccerdata/issues/780 **Describe the bug** I want to scrape soccer data and my scraping code, that works for months, doesn't work now. **Affected scrapers** This affects the following scrapers: - [ ] ClubElo - [ ] ESPN - [ ] FBref - [ ] FiveThirtyEight - [x] 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. ```python import json import os import pyodbc from class_Match import Match from soccerdata import FotMob from soccerdata import fbref as sd import pandas as pd from pathlib import Path from openpyxl import load_workbook pd.set_option('display.max_columns', None) # Setze die Parameter für den Tor-Proxy tor_proxy = { 'http': 'socks5h://localhost:9150', 'https': 'socks5h://localhost:9150' } path = Path('C:/Users/tobia/soccerdata/data/FotMob/matches/Bundesliga') # Erstelle eine Instanz von FotMob und verwende den Tor-Proxy fotmob = FotMob(leagues='GER-Bundesliga', seasons=[23, 24, 25], proxy=tor_proxy, data_dir= path) match_stats = fotmob.read_team_match_stats(stat_type='Top stats', team=None) #print(FotMob.available_leagues()) ``` **Error message** Traceback (most recent call last): File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 198, in _new_conn sock = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\connection.py", line 85, in create_connection raise err File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 793, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request conn.request( File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 400, in request self.endheaders() File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1314, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1074, in _send_output self.send(msg) File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1018, in send self.connect() File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 238, in connect self.sock = self._new_conn() ^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 213, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000002B3B0517290>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 847, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='46.101.91.154', port=6006): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002B3B0517290>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\soccerdata\fotmob.py", line 85, in _init_session r = requests.get("http://46.101.91.154:6006/") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 73, in get return request("get", url, params=params, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='46.101.91.154', port=6006): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002B3B0517290>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\tobia\OneDrive\Dokumente\Steuern_allgemein\Python_Projekte\API_Soccerdata\Bundesliga_FotMob2SQLSERVER.py", line 22, in <module> fotmob = FotMob(leagues='GER-Bundesliga', seasons=[23, 24, 25], proxy=tor_proxy, data_dir= path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\soccerdata\fotmob.py", line 69, in __init__ super().__init__( File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\soccerdata\_common.py", line 505, in __init__ self._session = self._init_session() ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tobia\AppData\Local\Programs\Python\Python312\Lib\site-packages\soccerdata\fotmob.py", line 88, in _init_session raise ConnectionError("Unable to connect to the session cookie server.") ConnectionError: Unable to connect to the session cookie server.``` ``` **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. - [x] I’m not able to fix this issue.
kerem 2026-03-02 15:56:19 +03:00
  • closed this issue
  • added the
    bug
    label
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#165
No description provided.