garmin
garmin copied to clipboard
mechanize crash
tried script with mixed result -- downloaded about 120 workouts, then crashed with
2015-01-31_700755201.txt is downloading...
Traceback (most recent call last):
File "download.py", line 207, in
Also, suggestion -- .txt file extension is confusing, maybe better to choose .tcx or .gpx
This is for the download.py script -- sorry, seeing only now that you have a lot of other stuff in this repository, too.
Is it a specific workout that it crashes on (e.g. 2015-01-31_700755201
) or after a specific number of downloads (e.g. ~120) or just completely random?
The 500 error referenced is reminiscent of what was plaguing even the manual TCX download on Garmin Connect for months.
Agree on the download extension, too; feel free to submit a PR for that!
I've tried running it several more times, and it always times out before downloading all of the workouts in my account, usually after a handful of workouts. Since it doesn't re-download files, I've collected most of what I need, step by step. I'm not sure if the mechanize library is just overly sensitive to something; or garmin's servers are flaky as hell. The first time (reported above, when I was able to grab 120 files in one go) was on a very good internet connection - maybe that's also a factor.
I have only the one garmin account, and not much insight into these processes, so I probably don't have much more to contribute.
Merry Christmas --
Thank you for the descriptive feedback; that's very helpful.
I'm currently traveling so I don't have the best bandwidth right now for testing, but I've committed a refactoring in a separate branch that no longer relies on mechanize. If you're able, feel free to check out that branch (requests
) and test it out; from a black-box perspective it should be functionally identical.
Merry Christmas to you as well, and Happy New Year!
~/Downloads/garmin-requests% sudo pip install mechanicalsoup
[...]
~/Downloads/garmin-requests% /usr/bin/python download.py -u ***********
Garmin account password (NOT saved):
Attempting to login to Garmin Connect...
Traceback (most recent call last):
File "download.py", line 200, in
Any ideas?
Ooh. What version of Python are you using? I think that error goes away in Python 3.
Some alternative for Python 3? Mechanize only works on 2.x I tried to do it myself with RoboBrowser but my python level is not enough for it