Skip to content

Commit

Permalink
allow overriding activity type from CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
dlenski committed Mar 28, 2018
1 parent eec4dcf commit 34c7a82
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions upload_activity.py
Expand Up @@ -41,6 +41,8 @@
'-D', '--description', help="Activity description on Garmin Connect.")
parser.add_argument(
'-P', '--private', action='store_true', help="Make activity private on Garmin Connect.")
parser.add_argument(
'-T', '--type', help="Override activity type (running, cycling, walking, hiking, strength_training, etc.)")
parser.add_argument(
"--log-level", metavar="LEVEL", type=str,
help=("Desired log output level (DEBUG, INFO, WARNING, ERROR). "
Expand All @@ -61,9 +63,9 @@
for activity in args.activity:
log.info("uploading activity file {} ...".format(activity.name))
try:
id = client.upload_activity(activity, name=args.name, description=args.description, private=args.private)
id = client.upload_activity(activity, name=args.name, description=args.description, private=args.private, activity_type=args.type)
except Exception as e:
log.error("upload failed: {}".format(e))
log.error("upload failed: {!r}".format(e))
else:
log.info("upload successful: https://connect.garmin.com/modern/activity/{}".format(id))
except Exception as e:
Expand Down

0 comments on commit 34c7a82

Please sign in to comment.