From d6cf78839ad354bf274f65c3427b83f5fb71a88e Mon Sep 17 00:00:00 2001 From: Jacek Date: Thu, 25 Feb 2021 14:32:10 +0100 Subject: [PATCH] Optimized number of requests for activities --- stravaio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stravaio.py b/stravaio.py index ced7508..288791d 100644 --- a/stravaio.py +++ b/stravaio.py @@ -94,11 +94,11 @@ def get_logged_in_athlete_activities(self, after=0, list_activities=None): if list_activities is None: list_activities = [] after = date_to_epoch(after) - _fetched = self.activities_api.get_logged_in_athlete_activities(after=after) + _fetched = self.activities_api.get_logged_in_athlete_activities(after=after, per_page = 200) if len(_fetched) > 0: print(f"Fetched {len(_fetched)}, the latests is on {_fetched[-1].start_date}") list_activities.extend(_fetched) - if len(_fetched) == 30: + if len(_fetched) == 200: last_after = list_activities[-1].start_date return self.get_logged_in_athlete_activities(after=last_after, list_activities=list_activities) else: