Garmin Connect Export via bat-file

235 views
Skip to first unread message

Guido

unread,
Feb 25, 2021, 5:32:30 AM2/25/21
to golden-cheetah-users
NE1 else having trouble exporting the fit-files from Garmin Connect via the bat-file.

I'm getting a "HTTPError: HTTP Error 402: Payment Required"

???


TIA
Guido

RB

unread,
Feb 25, 2021, 5:47:30 AM2/25/21
to golden-cheetah-users
Hi Guido,

I also experienced these problems after some google searches i found that there is an solution for it to add an extra header to the http request NK:NT (not sure where it is for)

in function:
def http_req(url, post=None, headers=None):

add the following line:
request.add_header('NK', 'NT')"

Kind Regards,
Remco

The Meek

unread,
Feb 25, 2021, 8:07:13 AM2/25/21
to golden-cheetah-users
Hello Remco
Having the same issue, "Error..Payment Required"

Added your line (without the last ") in the python file after the existing request statement: 

             def http_req(url, post=None, headers=None):
             """Helper function that makes the HTTP requests."""
             request = urllib2.Request(url)
             request.add_header('NK', 'NT')

It removes the Error message but the sequence doesnt download any new activity files. 
Thanks for any help to rectify. 

Curious where these changes are born, changes at Garmin?

Remco Boerwinkel

unread,
Feb 25, 2021, 8:29:13 AM2/25/21
to golden-cheetah-users
Hi,

Not sure which version you are using, there are multiple forks, and which command line arguments you are using and which exact error do you get or just no download.
For example if you are using the "-c new" command line option you might try once "-c 2".

Furthermore I placed it under the following header (not sure if order of headers does have any effect):
request.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, \
like Gecko) Chrome/54.0.2816.0 Safari/537.36')

And I assume this is a change from the Garmin site.

Kind regards,
Remco


--
_______________________________________________
Golden-Cheetah-Users mailing list
golden-che...@googlegroups.com
http://groups.google.com/group/golden-cheetah-users?hl=en
---
You received this message because you are subscribed to the Google Groups "golden-cheetah-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golden-cheetah-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golden-cheetah-users/1a86bc3e-63f8-47e2-a9de-3a26a70be2dan%40googlegroups.com.

Ale Martinez

unread,
Feb 25, 2021, 8:35:36 AM2/25/21
to golden-cheetah-users

Remco Boerwinkel

unread,
Feb 25, 2021, 11:04:02 AM2/25/21
to golden-cheetah-users

The Meek

unread,
Feb 25, 2021, 12:08:34 PM2/25/21
to golden-cheetah-users
Hello Remco

I moved the location of the new 'request' and swapped -c new for -c 2. That worked. Just tried a dummy activity with -c new and that worked too. 
Thanks very much. 

I am likely well out of date, gcexport.py (SCRIPT_VERSION = '2.3.0' with python 2.7 ). I'm glad it's working, for now, but know i need to learn more so can update. 

Many thanks. 

Guido

unread,
Feb 26, 2021, 6:20:20 AM2/26/21
to golden-cheetah-users
Thanks for the quick reply and fix. It works again :-)

To be shure where could I find the latest version?


Guido

Op donderdag 25 februari 2021 om 18:08:34 UTC+1 schreef The Meek:

The Meek

unread,
Feb 26, 2021, 8:29:49 AM2/26/21
to golden-cheetah-users
Believe this is the place for latest version 3.0.3, download from "code" drop down.

I have upgraded to 3.0.3 and Python 3.9.2. 
Is it correct the "-c new" switch is not supported in the newer version, only a number count or ALL? 
The same does seem to work with 2.3.0 and Pyton 2.7

RB

unread,
Feb 26, 2021, 10:24:29 AM2/26/21
to golden-cheetah-users
Hi,

Correct the main repository does not support the new option. the new option is potential error prone due an save in ".settings" which contains the last activity id
see discussion:

There are some branches that still have it in but hopefully there will will be an solution (see last comment)

Kind Regards,
Remco
Reply all
Reply to author
Forward
0 new messages