petergardfjall / garminexport

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

Move root garminbackup.py script into garminexport and break it into two functions #44

Closed khrapovs closed 4 years ago

khrapovs commented 4 years ago

This change has the same purpose as https://github.com/petergardfjall/garminexport/pull/43. But here instead of passing a large number of arguments like username, password, etc., one has to pass a single object args with corresponding attributes used in the original script. No regressions are introduced, the root script is still there. The benefit is that one can use this library in another python script like so:

from garminexport.garminbackup import garminbackup
args = MyArgs(username=garmin_login, password=garmin_password,
              file_format=['json_summary'], backup_dir=os.path.join(path_garmin_files, 'json'))
garminbackup(args=args)

Thanks to @tgrecojr for seeing that I am not alone in need for such a change.

khrapovs commented 4 years ago

Nice! Thanks for a very detailed review! If you are quick to respond, I am ready to invest much more in this package.

petergardfjall commented 4 years ago

Nice! Thanks for a very detailed review! If you are quick to respond, I am ready to invest much more in this package.

Thanks for the changes! I apologize for not having looked at this sooner. I've been a bit busy. I'll try to find some time to look at it more closely in the coming days.

petergardfjall commented 4 years ago

This was a substantial improvement of the code base, taking it in a nice library direction. Thank you @khrapovs!