stravalib.client.Client.get_segment_efforts#

Client.get_segment_efforts(segment_id: int, athlete_id: int | None = None, start_date_local: datetime | str | None = None, end_date_local: datetime | str | None = None, limit: int | None = None) BatchedResultsIterator[BaseEffort][source]#

Gets all efforts on a particular segment sorted by start_date_local

Returns an array of segment effort summary representations sorted by start_date_local ascending or by elapsed_time if an athlete_id is provided.

NOTES: * The athlete_id sorting only works if you do NOT provide start and end dates. * If no date filtering parameters are provided, all efforts for the segment will be returned.

Date range filtering is accomplished using an inclusive start and end time. start_date_local and end_date_local must be sent together. For open ended ranges pick dates significantly in the past or future. The filtering is done over local time for the segment, so there is no need for timezone conversion. For example, all efforts on Jan. 1st, 2024 for a segment in San Francisco, CA can be fetched using 2024-01-01T00:00:00Z and 2024-01-01T23:59:59Z.

This endpoint requires a Strava subscription.

Parameters:
  • segment_id (int) – ID for the segment of interest

  • start_date_local (datetime.datetime or str, optional, default=None) – Efforts before this date will be excluded. Either as ISO8601 or datetime object

  • end_date_local (datetime.datetime or str, optional, default=None) – Efforts after this date will be excluded. Either as ISO8601 or datetime object

  • limit (int, default=None, optional) –

    limit number of efforts. This parameter has been removed by Strava and will be removed in stravalib in the near future. .. deprecated:

    This param is not supported by the Strava API and may be
    removed in the future.
    

  • athlete_id (int, default=None) –

    Strava ID for the athlete. Used to sort efforts by duration. Can only be used if start and end date are not provided. .. deprecated:

    This param is not supported by the Strava API and may be
    removed in the future.
    

Returns:

class – An iterator of stravalib.model.SegmentEffort efforts on a segment.

Return type:

BatchedResultsIterator

Notes

https://developers.strava.com/docs/reference/#api-SegmentEfforts-getEffortsBySegmentId