Skip to content
This repository has been archived by the owner on Sep 25, 2020. It is now read-only.

Commit

Permalink
Garmin changed it's endpoint
Browse files Browse the repository at this point in the history
Upload was failing because of that, need headers now too.
  • Loading branch information
euri10 committed Feb 16, 2017
1 parent 4ba5779 commit ec5a274
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gols/gols.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def cli(config, debug):
help='Get notified')
@click.option('--move/--no_move', '-m', default=False,
help='Move files upon upload')


def upload(config, directory_fit, notification, move):
username = config.configdict['username']
password = config.configdict['password']
Expand Down Expand Up @@ -170,14 +172,17 @@ def upload(config, directory_fit, notification, move):
req_post_auth))
logger.info('Let\'s upload stuff now')
# login should be done we upload now
url_upload = 'https://connect.garmin.com/proxy/upload-service-1.1/json/upload/.fit'

#url_upload = 'https://connect.garmin.com/proxy/upload-service-1.1/json/upload/.fit'
url_upload = 'https://connect.garmin.com/modern/proxy/upload-service/upload/.fit'
if len(os.listdir(directory_fit)):
for filename in os.listdir(directory_fit):
logger.info('uploading: {}'.format(filename))
files = {'data': (filename,
open(os.path.join(directory_fit, filename), 'rb'),
'application/octet-stream')
}
s.headers.update({'Referer':'https://connect.garmin.com/modern/import-data', 'NK':'NT'})
req5 = s.post(url_upload, files=files)
if req5.status_code != 200:
logger.info(
Expand Down

0 comments on commit ec5a274

Please sign in to comment.