Open philosowaffle opened 3 years ago
Hey @philosowaffle ,
I reproduce the issue: the project unit tests are failing on the authentication.
I'll try to quickly find a fix, I'll keep you posted here
This time it's Cloudflare rejecting the requests.
I get a nice error page, with the infamous 1020 Cloudflare error. This may take some time to fix...
Oh no :(
Cloudflare is awesome for keeping our favorite sites online, but as an indy dev who just wants to automate things, I hate it lol
You can try this rough patch : https://github.com/La0/garmin-uploader/pull/29/files
I got some auth requests to work with this code, but now i'm getting HTTP 429 Too many requests
:sob:
Thank you for the quick patch attempt! I'm at work so won't be able to verify till tonight.
On the 429 error, I've had good luck with switching onto a VPN. The 429 seems tied to IP address, so if you hop on a vpn then you get another 10-20 requests before it throws 429 again. And I think the cool off period is about 1hr.
How can we pull this fix. I would like to test it.
I had similar problem with my code. Actually itis the cloudflare protection that kicks in. I got it working using cloudscraper
library to make the request. Here is a similar py libarary where this is duscussed.
https://github.com/cyberjunky/python-garminconnect/issues/46
i can confirm Cyberjunky fix looks like its working, I'm testing it live now
@kenlpeters You can try my patch with the following pip command:
pip install https://github.com/La0/garmin-uploader/archive/fix-cloudfare-errors.zip
Still get authentication failed. Not even too many requests
I checked out fix-cloudfare-errors
, switched conftest.py
to use my dev credentials, then ran the unit tests. Unfortunately, most are still failing with Authentication Failed
. Same error if I use the default guploader
creds as well.
Double integration (two accounts on one HA instance) running OK for more than 3 hours now, see
I'll try clouscrapper tommorow
The CI is ok on the current branch, except on Python 3.7 :man_shrugging:
@La0 - let me know when 3.7 is working. Unfortunately that is the version I am running... go figure.
@kenlpeters I just re-ran the CI, and it worked. I get the same results locally on multiple Python versions, and on multiple accounts / servers.
Please test this version !
I must not be downloading the proper version of the api.py. Can you link the right version.
Any update on this. I am still running into the authentication error. I just think it is a fact that I am not pulling the proper version of the software.
@kenlpeters I just re-ran the CI, and it worked. I get the same results locally on multiple Python versions, and on multiple accounts / servers.
Please test this version !
It's working for me now thanks!
Great how to get the newest version.
Any update on this. I am still running into the authentication error. I just think it is a fact that I am not pulling the proper version of the software.
For me I had the old version installed in ~/.local and nothing else there. So I removed all of that directory, then cloned this repo, switched branches and ran
python3 setup.py install --user
Little out of my league. Is there a link to the newest branch/repo to download On May 20, 2021, 7:57 AM -0400, Mario Limonciello @.***>, wrote:
Any update on this. I am still running into the authentication error. I just think it is a fact that I am not pulling the proper version of the software. For me I had the old version installed in ~/.local and nothing else there. So I removed all of that directory, then cloned this repo, switched branches and ran python3 setup.py install --user — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I think I downloaded the proper branch (cloud fare fixes) and unzipped and run the setup.py. Still I am getting Authenication error.
I tried the CI branch as well and it did not work. So obviously I am downloading the right branch.
I think I downloaded the proper branch (cloud fare fixes) and unzipped and run the setup.py. Still I am getting Authenication error.
Assuming you're not hitting a different failure and are running the wrong code still - if I was to guess, you're still getting the wrong copy from a local install somewhere else that has higher precedence (like site-packages or dist-packages). You should try doing pip uninstall garmin-uploader
.
Did you download the cloud fare fixes branch?
Yes. Basically I did:
rm ~/.local -r
git clone https://github.com/La0/garmin-uploader/
git checkout fix-cloudfare-errors
python3 setup.py install --user
gupload .....
and verified it's working for me now.
Another option, if you do not want to bother with installing/uninstalling packages:
> git clone https://github.com/La0/garmin-uploader/
> git checkout fix-cloudfare-errors
> pip install -r requirements.txt
> pip install -r requirements-tests.txt
> cd tests
> pytest
This runs the unit tests with a default set of credentials. If you would like to try running the unit tests with your personal credentials then modify here.
@La0 , assuming what I have outlined above is correct, I am still seeing Authentication failures :(
It fails the check on line 134 in api.py
and raises the Authentication failed.
exception (which bubbles up and is masked by the Invalid Credentials
exception). Fails for both your test user and my with my user creds. I am on python 3.6.4
.
@superm1 pardon snooping on your GH account, but looks like you're based in Texas. I am also based in Texas, so I guess that rules out different regional rules CloudFlare could be enforcing.
So I am not getting invalid credentials even though my credentials are correct.
@philosowaffle - Same here. Python 3.7 invalid credentials both with default and my person ones.
It fails the check on line 134 in api.py and raises the Authentication failed. exception (which bubbles up and is masked by the Invalid Credentials exception). Fails for both your test user and my with my user creds. I am on python 3.6.4.
On my side I tried the unit tests with the test user, no problem too. Python 3.8.5 though in case that's mattering.
$ pytest-3
================================================= test session starts ==================================================
platform linux -- Python 3.8.5, pytest-4.6.9, py-1.8.1, pluggy-0.13.0
rootdir: /home/supermario/garmin-uploader
collected 5 items
test_api.py .. [ 40%]
test_user.py .. [ 80%]
test_workflow.py . [100%]
=============================================== 5 passed in 6.08 seconds ===============================================
@superm1 pardon snooping on your GH account, but looks like you're based in Texas. I am also based in Texas, so I guess that rules out different regional rules CloudFlare could be enforcing.
Ah glad you did snoop, that was my thought too just now.
For me the unit test fails using python 3.9.0 in pyenv on Mac
Do we know what versions it does work on?
@kenlpeters This is likely not related to python version since the CI job is passing for multiple CI versions, including 3.7 and superm1 confirmed it works for him on 3.8.5
We are just sharing python info to help identify if any patterns exist.
Cool - if there is anything I can contribute let me know.
Not that it matters but I running Debian on a AWS virtual machine
I found something interesting. When we make the request to sso.garmin.com/sso/signin to get the _csrf. the page that gets returned does not have the code in it because it requires you to be using a browser to have JavaScript enabled. It appears they are checking to see if the browser has javascript and if it doesn't it won't show the screen. This may help.
Guys it just started working for me :)
Hey guys, sorry for the delay.
I'm gonna merge this code and publish a release at it seems to be working at least for some users. Looks like you may be hitting too many requests or a geo-block. i'll investigate cloudscrapper this weekend
garmin-uploader 1.0.10 is now available with this patch.
You can now run:
pip install garmin-uploader=1.0.10
Works great. Except there definitely is a limiter on the number of requests. I wonder what the time frame is before it resets.
Want want to confirm, the patch is still not working for me :( But it is atleast working for some people.
Now it is returning no login form. It seems Garmin is definitely having issue with their SSO
i, too, am still having issues (Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32)
Still no dice on my end either. Would it be worth while doing a wireshark trace or something?
I made a version using cloudscraper, but it seems to work only sometimes... That runs OK on my computer, but Github CI has 4 failures out of 5 runs :sob:
You can try that version using:
pip install https://github.com/La0/garmin-uploader/archive/cloudscraper.zip
For now the original CI (not cloudscraper) is working on AWS node server. So I am going to stick with that. Thanks for all of your hard work getting this back to operational status. I will say it seems to me that Garmin made a change, and slowly allowed regionds/IP schemas to access. It is the only think that makes sense. I hope that the others see it start working.
@La0, thank you for trying the switch to cloudscraper, unfortunately not working for me still😢
Maybe we make an LLC and try to get approved with the Garmin connect activity api and then the project can have an option to enter commercial creds... It's a pain but it says approval in 2 days, maybe it's a light process
Maybe we make an LLC and try to get approved with the Garmin connect activity api and then the project can have an option to enter commercial creds... It's a pain but it says approval in 2 days, maybe it's a light process
I contacted them about official API support a few years back, and it was only available for a few select users, with deep pockets (from 5 to 10k USD). That may have changed, but even if it was free and easy to setup, every user would have to setup its own app on their website: we would not be able to ship the library with credentials.
Howdy,
Seems Garmin has yet again tweaked some things and I have several users (including myself) running into auth failures. https://github.com/philosowaffle/peloton-to-garmin/issues/109
Thank you in advance for any help!