petergardfjall / garminexport

Garmin Connect activity exporter and backup tool
Apache License 2.0
500 stars 85 forks source link

Http 402 error #90

Closed Hblust closed 1 year ago

Hblust commented 1 year ago

Hello, this has been working flawlessly for me for a long time. Just this week it stopped working. I set debug level and got the following:

It appears to get an authorization after login then when it tries to list activities I get the following:

2022-12-17 12:07:38,910 [INFO] {list_activities}: attempt 1 ... 2022-12-17 12:07:38,911 [DEBUG] fetching activities 0 through 99 ... 2022-12-17 12:07:38,945 [DEBUG] https://connect.garmin.com:443 "GET /proxy/activitylist-service/activities/search/activities?start=0&limit=100 HTTP/1.1" 402 0 2022-12-17 12:07:38,949 [DEBUG] {list_activities}: failed: error: failed to fetch activities 0 to 99 types: 402

2022-12-17 12:07:38,950 [INFO] {list_activities}: waiting 1 seconds for next attempt

It appears to be a 402 error It tries this till it hits max-retries and fails.

Is there a way to check if Garmin is throttling the request?

MeisterP commented 1 year ago

This has been working flawlessly for me for a long time. Just this week it stopped working.

Same here. Stopped working yesterday.

andreloeffelmann commented 1 year ago

Same here. Did they stopped the activitylist-service API? :(

MeisterP commented 1 year ago

Did they stopped the activitylist-service API?

I don't think so. I use cyberjunky/python-garminconnect in another project. It's accessing proxy/activitylist-service/activities/search/activities as well and is still working.

cabby26 commented 1 year ago

Same issue: failed with exception: {}: gave up after list_activities failed attempt(s)

Last Monday it still worked.

nowster commented 1 year ago

A potential fix is in #92 .

andreloeffelmann commented 1 year ago

A potential fix is in #92 .

this works! thanks a lot :-)

WBMol commented 1 year ago

Can confirm #92 works. Manually installed as follows (in a virtuelenv):

pip install git+https://github.com/nowster/garminexport.git@nowster/404fix

Hblust commented 1 year ago

@nowster after some fiddling I got your version installed and it is working. I am new to github so forgive the noob question. What comes next? I think your new functionality gets 'merged' into the master. How does one uninstall that versions and get back to the master once it is merged?

seb2020 commented 1 year ago

@petergardfjall can you merge the PR ?

chipbite commented 1 year ago

I can also confirm that adding the header nk with value NT avoids the 402 response and successfully retrieves the data. This yields a 402 error response code: curl "https://connect.garmin.com/proxy/activitylist-service/activities/chipbite?start=1&limit=10" -i

Whereas this works: curl "https://connect.garmin.com/proxy/activitylist-service/activities/chipbite?start=1&limit=10" -H "nk: NT" -i

petergardfjall commented 1 year ago

Should be fixed by 188e97e26ca2bac86d13fbe11d929a1cabf987f5 on master.

petergardfjall commented 1 year ago

New release (0.4.2) published to PyPi.