stravalib.client.Client.upload_activity#

Client.upload_activity(activity_file: SupportsRead[str | bytes], data_type: Literal['fit', 'fit.gz', 'tcx', 'tcx.gz', 'gpx', 'gpx.gz'], name: str | None = None, description: str | None = None, activity_type: ActivityType | None = None, private: bool | None = None, external_id: str | None = None, trainer: bool | None = None, commute: bool | None = None) ActivityUploader[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 (TextIOWrapper, str or bytes) – 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, default=None) – If not provided, will be populated using start date and location, if available

  • description (str, optional, default=None) – 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 WARNING - This param is supported (as of 2022-11-15), but not documented and may be removed in the future.

  • private (bool, optional, default=None) –

    Set to True to mark the resulting activity as private, ‘view_private’ permissions will be necessary to view the activity.

    Deprecated since version 1.0: This param is not supported by the Strava API and may be removed in the future.

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

  • trainer (bool, optional, default=None) – Whether the resulting activity should be marked as having been performed on a trainer.

  • commute (bool, optional, default=None) – Whether the resulting activity should be tagged as a commute.