r/Python • u/GioGiac Pythonista • 1d ago
Showcase A lightweight Python wrapper for the Strava API that makes authentication painless
What My Project Does
Light Strava Client is a minimalist Python wrapper around the Strava API that automates the entire OAuth flow and token management. It provides a clean, typed interface for accessing Strava data while handling all the authentication complexity behind the scenes.
Key features:
- Automated OAuth flow (just paste the callback URL and you're done)
- Automatic token refresh handling
- Type-safe responses using Pydantic
- Simple to extend with new endpoints
- No complex dependencies
Target Audience
This is primarily designed for developers who want to quickly prototype or build personal projects with Strava data. While it can be used in production, it's intentionally kept minimal to prioritize hackability and ease of understanding over comprehensive feature coverage.
Comparison
The main alternative is stravalib, which is a mature and feature-complete library. Light Strava Client takes a different approach by offering a minimal, modern (Pydantic, type hints) codebase that prioritizes quick setup and hackability over comprehensive features.
The code is available here: https://github.com/GiovanniGiacometti/Light-Strava-Client
I'd love to hear your thoughts or feature suggestions!
4
u/coldoven 1d ago
License missing
3
u/GioGiac Pythonista 1d ago
Just added, thanks!
5
u/coldoven 1d ago
As good practise, you want to put it into pyproject.toml as well, since then tools like pip-licenses can automatically read it. In some companies, this is mandatory.
3
2
u/runawayasfastasucan 1d ago
This is really neat!! I think much of the stats on Strava (even that I have access to) is presented in a bad way, and that there are so much more that could be done with the data (comparing similar sessions for instance). Gonne use this in a notebook to see what I can do.
2
u/ionburger 1d ago
i have a side project that basically died because i didnt like stravalib, will give it another shot with this
1
u/OhYourFuckingGod 22h ago
Does it reauth if the refresh token is expired?
3
u/Mkep 19h ago
1
u/OhYourFuckingGod 13h ago
I just glanced at the code but to me it looked like an expired refresh token would fall through the cracks. E.g. would not get initialized, and also not refreshed.
13
u/yuppiepuppie 1d ago
Nice! I’ve been building something for my cycling data and was looking into the stava api. I’ll check this out!
Have you had any issues getting an api key, especially with regards to their recent terms and conditions changes that really effect third party apps?