PiotrMachowski / Xiaomi-cloud-tokens-extractor

This tool/script retrieves tokens for all devices connected to Xiaomi cloud and encryption keys for BLE devices.
MIT License
3.23k stars 333 forks source link

Solution for Errors: Max retries exceeded with url, ConnectTimeoutError #47

Closed Shaquu closed 2 years ago

Shaquu commented 2 years ago

I thought it will be good to share it for others (also for Google Search index ;) )

I have executed the script with my email and password, I left server empty and I got errors like below.

Error log ``` Traceback (most recent call last): File "C:\Python310\lib\site-packages\urllib3\connection.py", line 174, in _new_conn conn = connection.create_connection( File "C:\Python310\lib\site-packages\urllib3\util\connection.py", line 96, in create_connection raise err File "C:\Python310\lib\site-packages\urllib3\util\connection.py", line 86, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python310\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "C:\Python310\lib\site-packages\urllib3\connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "C:\Python310\lib\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn conn.connect() File "C:\Python310\lib\site-packages\urllib3\connection.py", line 358, in connect conn = self._new_conn() File "C:\Python310\lib\site-packages\urllib3\connection.py", line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (, 'Connection to api.io.mi.com timed out. (connect timeout=None)') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python310\lib\site-packages\requests\adapters.py", line 439, in send resp = conn.urlopen( File "C:\Python310\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen retries = retries.increment( File "C:\Python310\lib\site-packages\urllib3\util\retry.py", line 574, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.io.mi.com', port=443): Max retries exceeded with url: /app/home/device_list?signature=REDACTED (Caused by ConnectTimeoutError(, 'Connection to api.io.mi.com timed out. (connect timeout=None)')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\shaqmen\Downloads\token_extractor\token_extractor\token_extractor.py", line 222, in devices = connector.get_devices(current_server) File "C:\Users\shaqmen\Downloads\token_extractor\token_extractor\token_extractor.py", line 114, in get_devices return self.execute_api_call(url, params) File "C:\Users\shaqmen\Downloads\token_extractor\token_extractor\token_extractor.py", line 149, in execute_api_call response = self._session.post(url, headers=headers, cookies=cookies, params=fields) File "C:\Python310\lib\site-packages\requests\sessions.py", line 590, in post return self.request('POST', url, data=data, json=json, **kwargs) File "C:\Python310\lib\site-packages\requests\sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "C:\Python310\lib\site-packages\requests\sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "C:\Python310\lib\site-packages\requests\adapters.py", line 504, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.io.mi.com', port=443): Max retries exceeded with url: /app/home/device_list?signature=REDACTED (Caused by ConnectTimeoutError(, 'Connection to api.io.mi.com timed out. (connect timeout=None)')) ```

In my case, the solution was to disable the firewall on my router (temporarily).