pe-st / garmin-connect-export

Download a copy of your Garmin Connect data, including stats and GPX tracks.
MIT License
364 stars 75 forks source link

SSL: TLSV1_ALERT_PROTOCOL_VERSION #16

Open pe-st opened 5 years ago

pe-st commented 5 years ago

Two or three weeks ago the login still worked, but today the request to

https://connect.garmin.com/modern/activities?ticket=XXXX

fails with

[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)

Complete traceback:

Authenticating...Traceback (most recent call last):
  File "./gcexport.py", line 890, in <module>
    main(sys.argv)
  File "./gcexport.py", line 708, in main
    login_to_garmin_connect(args)
  File "./gcexport.py", line 436, in login_to_garmin_connect
    http_req(URL_GC_POST_AUTH + 'ticket=' + login_ticket)
  File "./gcexport.py", line 180, in http_req
    response = OPENER.open(request, data=post)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)>
pe-st commented 5 years ago

The problem goes away if I'm using the most recent Python 2.7.15 (installed with Homebrew) instead of the stock Python 2.7.10 of macOS Sierra or High Sierra (macOS Mojave should be fine).

Also make sure you don't start the script with ./gcexport.py, as this uses /usr/bin/python as specified on the script's first line (/usr/bin/python is the stock python). Use python gcexport.py instead.