Skip to content

Commit

Permalink
adding parameter to get_segment_leaderboard to specify exact leaderbo…
Browse files Browse the repository at this point in the history
…ard page to fetch
  • Loading branch information
b-jazz committed Dec 18, 2014
1 parent d96d9fe commit 9e9568a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion stravalib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,8 @@ def get_starred_segment(self, limit=None):


def get_segment_leaderboard(self, segment_id, gender=None, age_group=None, weight_class=None,
following=None, club_id=None, timeframe=None, top_results_limit=None):
following=None, club_id=None, timeframe=None, top_results_limit=None,
page=None):
"""
Gets the leaderboard for a segment.
Expand Down Expand Up @@ -807,6 +808,9 @@ def get_segment_leaderboard(self, segment_id, gender=None, age_group=None, weigh
See description for why this is a little confusing.
:type top_results_limit: int
:param page: (optional, strava default is 1) Page number of leaderboard to return, sorted by highest ranking leaders
:type page: int
:return: An iterator of :class:`stravalib.model.SegmentLeaderboard`
:rtype: :class:`BatchedResultsIterator`
Expand Down Expand Up @@ -845,6 +849,9 @@ def get_segment_leaderboard(self, segment_id, gender=None, age_group=None, weigh
if top_results_limit is not None:
params['per_page'] = top_results_limit

if page is not None:
params['page'] = page

return model.SegmentLeaderboard.deserialize(self.protocol.get('/segments/{id}/leaderboard',
id=segment_id,
**params),
Expand Down

0 comments on commit 9e9568a

Please sign in to comment.