stravalib.client.Client.upload_activity

Client.upload_activity(activity_file, data_type, name=None, description=None, activity_type=None, private=None, external_id=None)[source]

Uploads a GPS file (tcx, gpx) to create a new activity for current athlete.

https://developers.strava.com/docs/reference/#api-Uploads-createUpload

Parameters
  • activity_file (file or str) – The file object to upload or file contents.

  • data_type (str) – File format for upload. Possible values: fit, fit.gz, tcx, tcx.gz, gpx, gpx.gz

  • name (str) – (optional) if not provided, will be populated using start date and location, if available

  • description – (optional) The description for the activity

  • activity_type (str) – (optional) case-insensitive type of activity. possible values: ride, run, swim, workout, hike, walk, nordicski, alpineski, backcountryski, iceskate, inlineskate, kitesurf, rollerski, windsurf, workout, snowboard, snowshoe Type detected from file overrides, uses athlete’s default type if not specified

  • private (bool) – (optional) set to True to mark the resulting activity as private, ‘view_private’ permissions will be necessary to view the activity

  • external_id (str) – (optional) An arbitrary unique identifier may be specified which will be included in status responses.