strava-uploader icon indicating copy to clipboard operation
strava-uploader copied to clipboard

Unable to connect to www.strava.com

Open ash2005 opened this issue 5 years ago • 4 comments

Hello All, Thanks for the scripts, I did try to use it, but I always have this issue about SSL certificate, I did try both Python 2.7 & 3.7, w/ no Luck. here is the dump of the exception. Any help / fix is very much appreciated.

`C:\Data\Drv_E\Download\strava-uploader>C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\python.exe uploader.py [2019-10-04 10:43:25,921] [INFO]:Found access token [2019-10-04 10:43:25,922] [DEBUG]:Connecting to Strava Traceback (most recent call last): File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen chunked=chunked) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 343, in _make_request self._validate_conn(conn) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 839, in validate_conn conn.connect() File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 344, in connect ssl_context=context) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\ssl.py", line 345, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 423, in wrap_socket session=session File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 870, in _create self.do_handshake() File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 1139, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 449, in send timeout=timeout File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 399, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.strava.com', port=443): Max retries exceeded with url: /api/v3/athlete?access_token=bfa38b3261462057d03d8dba1bec2145a67193d5 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "uploader.py", line 336, in main() File "uploader.py", line 280, in main athlete = client.get_athlete() File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\stravalib\client.py", line 235, in get_athlete raw = self.protocol.get('/athlete') File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\stravalib\protocol.py", line 299, in get return self._request(url, params=params, check_for_errors=check_for_errors, use_webhook_server=use_webhook_server) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\stravalib\protocol.py", line 215, in _request raw = requester(url, params=params) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 537, in get return self.request('GET', url, **kwargs) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 524, in request resp = self.send(prep, **send_kwargs) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 637, in send r = adapter.send(request, **kwargs) File "C:\Users\UserAB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='www.strava.com', port=443): Max retries exceeded with url: /api/v3/athlete?access_token=bfa38b3261462057xxxxxxxxxxxxxxxxxxx5 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))`

ash2005 avatar Oct 04 '19 14:10 ash2005

is strava.com blocked on your computer/network?

if not, could you run this code in python 3.7 and let me know if it runs:

import requests

print(requests.get("http://www.google.com").status)

RoseApollo avatar Feb 22 '20 13:02 RoseApollo

The code you posted won't run for me in Python 3.7, although this does and I get a 200:

req = requests.get("http://www.google.com")
req.status_code

barrald avatar Feb 26 '20 13:02 barrald

Using python 3.9 and should work in 3.7. Does this fail? Is there a self signed proxy somewhere in your network? If Google works and Strava fails something is blocking the URL. import requests print(requests.get("https://www.google.com").status_code) print(requests.get("https://www.strava.com").status_code)

pcartwright81 avatar Nov 27 '20 19:11 pcartwright81

do you have a fire wall? if so check if it is blocking strava

RoseApollo avatar Nov 27 '20 19:11 RoseApollo