Registry / crm-productivity / stravalib

stravalib

JSON →
library2.4pypypi✓ verified 84d ago

A Python library for accessing the Strava V3 REST API. Current version is 2.4, requires Python >=3.10. Follows semantic versioning.

pip install stravalib
INSTALL
IMPORT
SIG · STRAVALIB
S
stravalib
crm-productivitypythonv2.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
from stravalib.client import Client
from stravalib import Client
Client is in stravalib.client module since v2.0
strava_client
from stravalib import strava_client

Set up a client with an access token and fetch the authenticated athlete's profile.

import os from stravalib.client import Client client = Client() client.access_token = os.environ.get('STRAVA_ACCESS_TOKEN', '') # Example: get current athlete athlete = client.get_athlete() print(f"Hello {athlete.firstname} {athlete.lastname}")
Debug
Known issues
breakingIn v2.0, the import path changed from `from stravalib import Client` to `from stravalib.client import Client`.
fix
Update imports: from stravalib.client import Client
affects: >=2.0
breakingMany model attributes changed from camelCase to snake_case in v2.0. For example, `athlete.firstname` became `athlete.firstname` (same) but some like `activity.start_date` changed from `start_date` to `start_date`? Actually check: `athlete.firstname` is still correct, but `athlete.lastname` used to be `athlete.lastname`. No breaking change reported. But be aware of renamed methods: e.g., `get_athlete` remains same.
fix
Review attribute names if upgrading from 1.x. Refer to v2 migration guide.
affects: >=2.0
breakingSome methods now return paginated results as generators instead of lists.
fix
Iterate over result or convert with list().
affects: >=2.0
deprecated`strava_client` module is still available but considered legacy; new code should use `Client` directly.
fix
Use `from stravalib.client import Client` instead.
affects: >=2.0
Errors
Common errors & fixes
ImportError: cannot import name 'Client' from 'stravalib'
Incorrect import path. In v2.0+, Client is in stravalib.client module.
fix
Use `from stravalib.client import Client`
AttributeError: 'Athlete' object has no attribute 'firstname'
In v2.0, camelCase attributes changed to snake_case. For example, 'firstname' remains 'firstname', but 'lastname' is still 'lastname'. Actually check: no change for firstname/lastname. This error might be due to using v1.x code on v2.x where some attributes changed. Example: 'email' vs 'email'? Verify.
fix
Check attribute names with dir(athlete) or consult docs. Known changes: 'city' -> 'city' (same), 'state' -> 'state', 'sex' -> 'sex'.
Upgrade
Version history
2.4latest on PyPI · released Jun 18, 2025
Audit
Dependencies
requestsrequiredHTTP library used for API requests
arrowrequiredDate/time handling
Agent activity
50 hits · last 30 days
node
42
Amazon
1
OpenAI (training)
1
Resources
stravalib — pip install stravalib · libregistry