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.

If no filtering parameters is provided all efforts for the segment will be returned.

Date range filtering is accomplished using an inclusive start and end time, thus 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, 2014 for a segment in San Francisco, CA can be fetched using 2014-01-01T00:00:00Z and 2014-01-01T23:59:59Z.

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

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

  • athlete_id (int, default=None) – ID of athlete.

  • 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.

  • athlete_id – Strava ID for the athlete

Returns:

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

Return type:

BatchedResultsIterator