How to use the stravalib.client.BatchedResultsIterator function in stravalib

To help you get started, we’ve selected a few stravalib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hozn / stravalib / stravalib / client.py View on Github external
http://strava.github.io/api/partner/v3/events/#list-push-subscriptions

        :param client_id: application's ID, obtained during registration
        :type client_id: int

        :param client_secret: application's secret, obtained during registration
        :type client_secret: str

        :return: An iterator of :class:`stravalib.model.Subscription` objects.
        :rtype: :class:`BatchedResultsIterator`
        """
        result_fetcher = functools.partial(self.protocol.get, '/push_subscriptions', client_id=client_id,
                                           client_secret=client_secret, use_webhook_server=True)

        return BatchedResultsIterator(entity=model.Subscription,
                                      bind_client=self,
                                      result_fetcher=result_fetcher)
github hozn / stravalib / stravalib / client.py View on Github external
are always returned.

        http://strava.github.io/api/v3/streams/#routes

        :param activity_id: The ID of activity.
        :type activity_id: int

        :return: A dictionary of :class:`stravalib.model.Stream`from the route.
        :rtype: :py:class:`dict`

        """

        result_fetcher = functools.partial(self.protocol.get,
                                           '/routes/{id}/streams/'.format(id=route_id))

        streams = BatchedResultsIterator(entity=model.Stream,
                                         bind_client=self,
                                         result_fetcher=result_fetcher)

        # Pack streams into dictionary
        return {i.type: i for i in streams}
github hozn / stravalib / stravalib / client.py View on Github external
http://strava.github.io/api/v3/clubs/#get-activities

        :param club_id: The numeric ID for the club.
        :type club_id: int

        :param limit: Maximum number of activities to return. (default unlimited)
        :type limit: int

        :return: An iterator of :class:`stravalib.model.Activity` objects.
        :rtype: :class:`BatchedResultsIterator`
        """
        result_fetcher = functools.partial(self.protocol.get,
                                           '/clubs/{id}/activities',
                                           id=club_id)

        return BatchedResultsIterator(entity=model.Activity, bind_client=self,
                                      result_fetcher=result_fetcher, limit=limit)
github hozn / stravalib / stravalib / client.py View on Github external
http://strava.github.io/api/v3/segments/#starred

        :param athlete_id: The ID of the athlete.
        :type athlete_id: int

        :param limit: (optional), limit number of starred segments returned.
        :type limit: int

        :return: An iterator of :class:`stravalib.model.Segment` starred by authenticated user.
        :rtype: :class:`BatchedResultsIterator`
        """
        result_fetcher = functools.partial(self.protocol.get,
                                           '/athletes/{id}/segments/starred',
                                           id=athlete_id)

        return BatchedResultsIterator(entity=model.Segment,
                                      bind_client=self,
                                      result_fetcher=result_fetcher,
                                      limit=limit)
github hozn / stravalib / stravalib / client.py View on Github external
:param year: year for the races (default current)
        
        :return: An iterator of :class:`stravalib.model.RunningRace` objects.
        :rtype: :class:`BatchedResultsIterator`
        """
        if year is None:
            year = datetime.datetime.now().year
    
        params = {"year": year}

        result_fetcher = functools.partial(self.protocol.get,
                                           '/running_races',
                                           **params)

        return BatchedResultsIterator(entity=model.RunningRace, bind_client=self,
                                      result_fetcher=result_fetcher)
github hozn / stravalib / stravalib / client.py View on Github external
http://strava.github.io/api/v3/kudos/#list

        :param activity_id: The activity for which to fetch kudos.
        :type activity_id: int

        :param limit: Max rows to return (default unlimited).
        :type limit: int

        :return: An iterator of :class:`stravalib.model.ActivityKudos` objects.
        :rtype: :class:`BatchedResultsIterator`
        """
        result_fetcher = functools.partial(self.protocol.get,
                                           '/activities/{id}/kudos',
                                           id=activity_id)

        return BatchedResultsIterator(entity=model.ActivityKudos,
                                      bind_client=self,
                                      result_fetcher=result_fetcher,
                                      limit=limit)
github hozn / stravalib / stravalib / client.py View on Github external
:return: An iterator of :class:`stravalib.model.ActivityPhoto` objects.
        :rtype: :class:`BatchedResultsIterator`
        """
        params = {}

        if not only_instagram:
            params['photo_sources'] = 'true'

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

        result_fetcher = functools.partial(self.protocol.get,
                                           '/activities/{id}/photos',
                                           id=activity_id, **params)

        return BatchedResultsIterator(entity=model.ActivityPhoto,
                                      bind_client=self,
                                      result_fetcher=result_fetcher)
github hozn / stravalib / stravalib / client.py View on Github external
:param activity_id: The activity for which to fetch comments.
        :type activity_id: int

        :param markdown: Whether to include markdown in comments (default is false/filterout).
        :type markdown: bool

        :param limit: Max rows to return (default unlimited).
        :type limit: int

        :return: An iterator of :class:`stravalib.model.ActivityComment` objects.
        :rtype: :class:`BatchedResultsIterator`
        """
        result_fetcher = functools.partial(self.protocol.get, '/activities/{id}/comments',
                                           id=activity_id, markdown=int(markdown))

        return BatchedResultsIterator(entity=model.ActivityComment,
                                      bind_client=self,
                                      result_fetcher=result_fetcher,
                                      limit=limit)
github hozn / stravalib / stravalib / client.py View on Github external
http://strava.github.io/api/v3/clubs/#get-members

        :param club_id: The numeric ID for the club.
        :type club_id: int

        :param limit: Maximum number of athletes to return. (default unlimited)
        :type limit: int

        :return: An iterator of :class:`stravalib.model.Athlete` objects.
        :rtype: :class:`BatchedResultsIterator`
        """
        result_fetcher = functools.partial(self.protocol.get,
                                           '/clubs/{id}/members',
                                           id=club_id)

        return BatchedResultsIterator(entity=model.Athlete, bind_client=self,
                                      result_fetcher=result_fetcher, limit=limit)