How to use the stravalib.model.Activity.deserialize 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
if not activity_type.lower() in [t.lower() for t in model.Activity.TYPES]:
            raise ValueError("Invalid activity type: {0}.  Possible values: {1!r}".format(activity_type, model.Activity.TYPES))

        params = dict(name=name, type=activity_type, start_date_local=start_date_local,
                      elapsed_time=elapsed_time)

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

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

        raw_activity = self.protocol.post('/activities', **params)

        return model.Activity.deserialize(raw_activity, bind_client=self)
github hozn / stravalib / stravalib / client.py View on Github external
Will be detail-level if owned by authenticated user; otherwise summary-level.

        http://strava.github.io/api/v3/activities/#get-details

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

        :param inclue_all_efforts: Whether to include segment efforts - only
                                   available to the owner of the activty.
        :type include_all_efforts: bool

        :rtype: :class:`stravalib.model.Activity`
        """
        raw = self.protocol.get('/activities/{id}', id=activity_id,
                                include_all_efforts=include_all_efforts)
        return model.Activity.deserialize(raw, bind_client=self)