Strava Activities Renamer is a Python 3 script for dumping all Strava activities to file, in CSV format, and (after editing the available property fields, that are listed in the table below) printing or updating them automatically.
| Property | Possible Actions |
|---|---|
| Name | print or remote update |
| Description | remote empty |
| Workout Type |
- clone this repository
- install
Python 3dependencies:pip3 install -r requirements.txt - create a new Strava application, from the "My API Application" tab from Settings
- get the client ID (referred to as
CLIENT_ID) and secret (referred to asCLIENT_SECRET), from the same Strava page
- generate a new authorization URL
./strava_activities_renamer.py get-code --client-id CLIENT_ID
[+] Authorization URL is: https://www.strava.com/oauth/authorize?client_id=CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%2Fget_the_code_parameter&approval_prompt=auto&response_type=code&scope=read%2Cread_all%2Cprofile%3Aread_all%2Cprofile%3Awrite%2Cactivity%3Aread%2Cactivity%3Aread_all%2Cactivity%3Awrite
- access the generated URL in the browser and, after giving permissions, get the
codeparameter from the redirect URL that will be referred to asCODE - generate a permanent token
./strava_activities_renamer.py get-token --client-id CLIENT_ID --client-secret CLIENT_SECRET --code CODE
[+] A new permanent token was generated, with the following details:
- access token: ACCESS_TOKEN
- refresh access token: REFRESH_ACCESS_TOKEN
- expired at: EXPIRED_AT
- check the validity of the token (optional)
./strava_activities_renamer.py check-token-validity --client-id CLIENT_ID --client-secret CLIENT_SECRET --refresh-access-token REFRESH_ACCESS_TOKEN --expires-at EXPIRED_AT
[+] Access token is still valid!
- dump all activities to file
./strava_activities_renamer.py get-activities --access-token ACCESS_TOKEN --output-file OUTPUT_FILENAME
[+] Number of saved activities: ACTIVITIES_COUNT
cat OUTPUT_FILENAME | head -n 1
ID,Name,Distance,Type,Workout type,Start date,Was manually added,Is private,Gear ID,Description
- copy the output file:
cp OUTPUT_FILENAME COPIED_FILENAME - edit the activities in the copy with a
CSVeditor - print or update the changes
./strava_activities_renamer.py update-activities --access-token ACCESS_TOKEN --original-file OUTPUT_FILENAME --modified-file COPIED_FILENAME --only-print
[+] Name changes are:
- for activity with ID ACTIVITY_ID (https://www.strava.com/activities/ACTIVITY_ID), from 'ORIGINAL_NAME' to 'MODIFIED_NAME'
[+] Type changes are:
- for activity with ID ACTIVITY_ID (https://www.strava.com/activities/ACTIVITY_ID), from ORIGINAL_ACTIVITY_TYPE to MODIFIED_ACTIVITY_TYPE
| Name | Description | Link |
|---|---|---|
| stravalib | Python 3 module for interacting with Strava API |
Github repository |
| click | Python 3 module for creating command line interfaces |
website |
| tqdm | Python 3 module for creating progress bars in the command line |
Github repository |