stravalib.client.Client.get_segment_leaderboard

Client.get_segment_leaderboard(segment_id, gender=None, age_group=None, weight_class=None, following=None, club_id=None, timeframe=None, top_results_limit=None, page=None, context_entries=None)[source]

Gets the leaderboard for a segment.

Note that by default Strava will return the top 10 results, and if the current user has ridden that segment, the current user’s result along with the two results above in rank and the two results below will be included. The top X results can be configured by setting the top_results_limit parameter; however, the other 5 results will be included if the current user has ridden that segment. (i.e. if you specify top_results_limit=15, you will get a total of 20 entries back.)

Parameters
  • segment_id (int) – ID of the segment.

  • gender (str) – (optional) ‘M’ or ‘F’

  • age_group (str) – (optional) ‘0_24’, ‘25_34’, ‘35_44’, ‘45_54’, ‘55_64’, ‘65_plus’

  • weight_class (str) – (optional) pounds ‘0_124’, ‘125_149’, ‘150_164’, ‘165_179’, ‘180_199’, ‘200_plus’ or kilograms ‘0_54’, ‘55_64’, ‘65_74’, ‘75_84’, ‘85_94’, ‘95_plus’

  • following (bool) – (optional) Limit to athletes current user is following.

  • club_id (int) – (optional) limit to specific club

  • timeframe (str) – (optional) ‘this_year’, ‘this_month’, ‘this_week’, ‘today’

  • top_results_limit (int) – (optional, strava default is 10 + 5 from end) How many of leading leaderboard entries to display. See description for why this is a little confusing.

  • page (int) – (optional, strava default is 1) Page number of leaderboard to return, sorted by highest ranking leaders

  • context_entries (int) – (optional, strava default is 2, max is 15) number of entries surrounding requesting athlete to return

Returns

The SegmentLeaderboard for the specified page (default: 1)

Return type

stravalib.model.SegmentLeaderboard