A few lines seem "too" long, maybe having the URLs as global constant would make things easier to read, maybe splitting the long literal strings on multiple lines could help as well. Not much to say about the style, your code looks good and seems to follow PEP 8. Also, you should try to document your functions : purpose and when relevant parameters and return value (I'll come back to this). Among other things, your script documentation should be in """triple-quoted string""". Indeed, there is a Convention for Python docstrings. However, other parts of the documentation can be improved.
Garmin connect export a run how to#
Interesting script! Here are a few comments to make it better :)ĭocumenting how to find the required values is a very nice touch, exactly the kind of things that helps a new user or maybe yourself in a few months. If previous_id and previous_id != END_ID : Previous_id = get_previous_activity_id(activity_id) Print('Issue getting the key for activity with id '.format(activity_id)) R = requests.get(url, headers=headers, cookies=cookies) 'From': get_previous_activity_id(activity_id): 'User-Agent': 'Some hobbyist runner and pythonista trying to bulk extract CSVs, get in touch if you have an issue with this', # Crawl politely, leave a way for them to contact you Click on it and copy the whole value of "Cookie" in Headers > Request Headers # Then, press F12, click on "Network", press F5, scroll to the very first element, it will have your as name. # To get started open garmin connect in Google Chrome, log in and grab the id of your latest activity as in ĮND_ID = 0 # Id to stop at if you've run this script before, leave 0 otherwise Here is the script: # This script runs through your Garmin Connect activities (New->Old) and saves them as CSV Possibility the add testing (what and how should I test?).Quality of overall structure & comments.Current script does the job but I'm really unsure regarding