petergardfjall / garminexport

Garmin Connect activity exporter and backup tool
Apache License 2.0
507 stars 83 forks source link

Activities don't download and a .not_found file is written to output folder #57

Closed Roaders closed 4 years ago

Roaders commented 4 years ago

When trying to run garmin backup I get the following:

pi@piName:~ $ garmin-backup --backup-dir=/mnt/networkShare --format fit me@server.com
2020-08-01 08:57:07,449 [INFO] backing up formats: fit
Enter password:
2020-08-01 08:57:11,338 [INFO] authenticating user ...
2020-08-01 08:57:12,549 [INFO] claiming auth ticket ...
2020-08-01 08:57:14,872 [INFO] scanning activities for me@server.com ...
2020-08-01 08:57:14,873 [INFO] {list_activities}: attempt 1 ...
2020-08-01 08:57:33,296 [INFO] account has a total of 2812 activities
2020-08-01 08:57:33,451 [INFO] /mnt/networkShare contains 0 backed up activities
2020-08-01 08:57:33,452 [INFO] activities that aren't backed up: 2812
2020-08-01 08:57:33,453 [INFO] backing up activity 267428142 from 2013-01-28 17:33:00+00:00 (1 out of 2812) ...
2020-08-01 08:57:33,460 [INFO] {get_activity_fit}: attempt 1 ...
2020-08-01 08:57:33,773 [INFO] {get_activity_fit}: waiting 1 seconds for next attempt
2020-08-01 08:57:34,775 [INFO] {get_activity_fit}: attempt 2 ...
2020-08-01 08:57:35,012 [INFO] {get_activity_fit}: waiting 2 seconds for next attempt
2020-08-01 08:57:37,015 [INFO] {get_activity_fit}: attempt 3 ...
2020-08-01 08:57:37,324 [INFO] {get_activity_fit}: waiting 4 seconds for next attempt

When running with DEBUG log level and max retries of 2 I get a bit more detail:

2020-08-01 09:02:32,970 [DEBUG] 0 tried but failed activities in /mnt/networkShare /.not_found
2020-08-01 09:02:33,109 [INFO] /mnt/networkShare contains 0 backed up activities
2020-08-01 09:02:33,110 [INFO] activities that aren't backed up: 2812
2020-08-01 09:02:33,110 [INFO] backing up activity 267428142 from 2013-01-28 17:33:00+00:00 (1 out of 2812) ...
2020-08-01 09:02:33,115 [DEBUG] getting fit for 267428142
2020-08-01 09:02:33,115 [INFO] {get_activity_fit}: attempt 1 ...
2020-08-01 09:02:33,329 [DEBUG] https://connect.garmin.com:443 "GET /modern/proxy/download-service/files/activity/267428142 HTTP/1.1" 400 None
2020-08-01 09:02:33,332 [DEBUG] {get_activity_fit}: failed: error: failed to get original activity file for 267428142: 400
<html><body><h1>400 Bad request</h1>
Your browser sent an invalid request.
</body></html>

2020-08-01 09:02:33,332 [INFO] {get_activity_fit}: waiting 1 seconds for next attempt
2020-08-01 09:02:34,334 [INFO] {get_activity_fit}: attempt 2 ...
2020-08-01 09:02:34,544 [DEBUG] https://connect.garmin.com:443 "GET /modern/proxy/download-service/files/activity/267428142 HTTP/1.1" 400 None
2020-08-01 09:02:34,548 [DEBUG] {get_activity_fit}: failed: error: failed to get original activity file for 267428142: 400
<html><body><h1>400 Bad request</h1>
Your browser sent an invalid request.
<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"rayId":"5bbe09a4db1de648","version":"2020.7.0","si":10}'></script>
</body></html>

2020-08-01 09:02:34,549 [INFO] {get_activity_fit}: waiting 2 seconds for next attempt
2020-08-01 09:02:36,552 [INFO] {get_activity_fit}: attempt 3 ...
2020-08-01 09:02:36,778 [DEBUG] https://connect.garmin.com:443 "GET /modern/proxy/download-service/files/activity/267428142 HTTP/1.1" 400 None
2020-08-01 09:02:36,788 [DEBUG] {get_activity_fit}: failed: error: failed to get original activity file for 267428142: 400
<html><body><h1>400 Bad request</h1>
Your browser sent an invalid request.
</body></html>

2020-08-01 09:02:36,791 [ERROR] failed with exception: {}: gave up after get_activity_fit failed attempt(s)
2020-08-01 09:02:36,812 [ERROR] failed with exception: {}: gave up after get_activity_fit failed attempt(s)

Garmin is saying bad request.

It also seems that despite trying and failing to load an activity I am still getting this:

2020-08-01 09:02:33,109 [INFO] /mnt/networkShare contains 0 backed up activities

Is this me or has garmin changed the service or is there an issue with garmin backup? Thanks

Roaders commented 4 years ago

I installed via pip3 and these are the details:

pi@piName:~ $ pip3 show garminexport
Name: garminexport
Version: 0.1.0
Summary: Garmin Connect activity exporter and backup tool
Home-page: https://github.com/petergardfjall/garminexport
Author: Peter Gardfjäll
Author-email: peter.gardfjall.work@gmail.com
License: Apache License 2.0
Location: /home/pi/.local/lib/python3.7/site-packages
Requires: python-dateutil, requests
Required-by:
pekkaski commented 4 years ago

I think the problem is with Garmin, also when trying a manual export of activity from Garmin Connect (.fit or .tcx), it gives the same error message: 400 Bad request Your browser sent an invalid request.

pavlinux commented 4 years ago

2020-08-05 02:10:47,371 [INFO] {get_activity_fit}: attempt 1 ... 2020-08-05 02:10:47,660 [INFO] {get_activity_fit}: waiting 1 seconds for next attempt 2020-08-05 02:10:48,662 [INFO] {get_activity_fit}: attempt 2 ... 2020-08-05 02:10:49,395 [INFO] {get_activity_fit}: waiting 2 seconds for next attempt 2020-08-05 02:10:51,397 [INFO] {get_activity_fit}: attempt 3 ... 2020-08-05 02:10:51,653 [INFO] {get_activity_fit}: waiting 4 seconds for next attempt 2020-08-05 02:10:55,657 [INFO] {get_activity_fit}: attempt 4 ... 2020-08-05 02:10:55,923 [INFO] {get_activity_fit}: waiting 8 seconds for next attempt 2020-08-05 02:11:03,931 [INFO] {get_activity_fit}: attempt 5 ... 2020-08-05 02:11:04,201 [INFO] {get_activity_fit}: waiting 16 seconds for next attempt 2020-08-05 02:11:20,218 [INFO] {get_activity_fit}: attempt 6 ... 2020-08-05 02:11:20,476 [INFO] {get_activity_fit}: waiting 32 seconds for next attempt

bnjmnschwn commented 4 years ago

At least for me the export works again. Also the download directly from garmin connect doesn't raise bad request error anymore.

Roaders commented 4 years ago

yup, working for me now. Thanks