petergardfjall / garminexport

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

Adding cloudscraper dependency to resolve cloudflare auth issues #80

Closed ghost closed 2 years ago

ghost commented 3 years ago

Fixes #79

matteoquintiliani commented 3 years ago

This change based on cloudscraper works for me. Thanks!

pavlinux commented 3 years ago

Garmin broke everything again

https://github.com/petergardfjall/garminexport/issues/79#issuecomment-846595874

ghost commented 3 years ago

@pavlinux it is still working for me

PS C:\projects\personal\jacobhell.github.io> garmin-backup fake_email --password fake_password
2021-05-23 13:36:02,058 [INFO] backing up formats: json_summary, json_details, gpx, tcx, fit
2021-05-23 13:36:02,203 [INFO] authenticating user ...
2021-05-23 13:36:02,204 [INFO] fetching CSRF token ...
2021-05-23 13:36:03,874 [INFO] claiming auth ticket ...
2021-05-23 13:36:06,131 [INFO] scanning activities for fake_email ...
2021-05-23 13:36:06,131 [INFO] {list_activities}: attempt 1 ...
2021-05-23 13:36:08,918 [INFO] account has a total of 585 activities
2021-05-23 13:36:09,033 [INFO] .\activities contains 582 backed up activities
2021-05-23 13:36:09,033 [INFO] activities that aren't backed up: 3
2021-05-23 13:36:09,035 [INFO] backing up activity 6824592079 from 2021-05-22 18:32:02+00:00 (1 out of 3) ...
2021-05-23 13:36:09,040 [INFO] {get_activity_summary}: attempt 1 ...
2021-05-23 13:36:09,206 [INFO] {get_activity_details}: attempt 1 ...
2021-05-23 13:36:09,474 [INFO] {get_activity_gpx}: attempt 1 ...
2021-05-23 13:36:10,174 [INFO] {get_activity_tcx}: attempt 1 ...
2021-05-23 13:36:11,371 [INFO] {get_activity_fit}: attempt 1 ...
2021-05-23 13:36:11,763 [INFO] backing up activity 6829167314 from 2021-05-23 13:42:52+00:00 (2 out of 3) ...
2021-05-23 13:36:11,764 [INFO] {get_activity_summary}: attempt 1 ...
2021-05-23 13:36:11,960 [INFO] {get_activity_details}: attempt 1 ...
2021-05-23 13:36:12,325 [INFO] {get_activity_gpx}: attempt 1 ...
2021-05-23 13:36:12,837 [INFO] {get_activity_tcx}: attempt 1 ...
2021-05-23 13:36:13,576 [INFO] {get_activity_fit}: attempt 1 ...
mainzelM commented 3 years ago

For me, the fix does not work:

2021-05-24 16:10:06,615 [INFO] backing up formats: json_summary, json_details, gpx, tcx, fit
2021-05-24 16:10:06,615 [INFO] authenticating user ...
2021-05-24 16:10:06,615 [INFO] fetching CSRF token ...
2021-05-24 16:10:06,912 [ERROR] failed with exception: authentication failure: did you enter valid credentials?
62north commented 3 years ago

This seems to solve my issue with v0.4.0 as well

specialist211 commented 3 years ago

I'm trying this fix as I have the same issue, The project builds ok, but running it give no output. Any suggestions? Thanks

petergardfjall commented 3 years ago

Thanks for the PR. Since I have no authentication issues myself with 0.4.0 I'm trying to better understand why this fix is needed, and to what degree it works. Is it foolproof or a hit-and-miss thing?

Related discussions can be found here https://github.com/petergardfjall/garminexport/issues/83#issuecomment-898863848 and here https://github.com/petergardfjall/garminexport/issues/79#issuecomment-898864066.

petergardfjall commented 2 years ago

The most recent version of garminexport (0.4.1) can optionally be installed with support for circumventing Cloudflare's bot challenges like so:

pip install garminexport[cloudflare]