This is a project aimed at tracking wear and usage of different bike components.
The idea here is to create a lightweight way to track usage and maintenance for individual bicycle components. I want to limit external dependencies and basically just get the minimum info from the activities and log it, with the ability then to see wear and tear by part, last time various maintenance tasks were performed, etc.
The following python libraries are required:
stravalib
dateparser
python-dotenv
keyring
The first step is to create an “app” with strava in order to access the API. Go to https://www.strava.com/settings/api and follow the directions for creating an application. Choose any name you want and set the callback domain to localhost
. You’ll need the client id and client secret later in this process.
Once you have this the application provides a function for authorizing and getting the application code, as well as exchanging that code for a refresh token.
The application will attempt to use your machine’s keyring to store the client credentials.
The application will also store your refresh token in the database file. It expires every 6 hours and without the client id or client secret it won’t do much good. Still, you probably don’t want to go around sharing this.
Finally, the project requires a .env
file to exist at the project root. It should take the following form:
export BDR=/path/to/project/directory/root export STRAVA_DB_PATH=/path/to/bike_wrench.db export SCHEMA_PATH=$BDR/bikeWrenchFlask/create_db.sql export CLIENT_SECRET='long$tringfromStrav@123456' export STRAVA_CLIENT_ID='12345'