Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.
/ StravaWorker Public archive

Script for miscellaneous operations with Strava activities: dumping, renaming and syncing with spreadsheets from OneDrive πŸƒ

Notifications You must be signed in to change notification settings

iosifache/StravaWorker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Strava Activities Renamer πŸƒ

Description πŸ–ΌοΈ

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 print

Setup πŸ”§

  1. clone this repository
  2. install Python 3 dependencies: pip3 install -r requirements.txt
  3. create a new Strava application, from the "My API Application" tab from Settings
  4. get the client ID (referred to as CLIENT_ID) and secret (referred to as CLIENT_SECRET), from the same Strava page

Usage 🧰

  1. 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
  1. access the generated URL in the browser and, after giving permissions, get the code parameter from the redirect URL that will be referred to as CODE
  2. 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
  1. 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!
  1. 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
  1. copy the output file: cp OUTPUT_FILENAME COPIED_FILENAME
  2. edit the activities in the copy with a CSV editor
  3. 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

Resources πŸ“š

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

About

Script for miscellaneous operations with Strava activities: dumping, renaming and syncing with spreadsheets from OneDrive πŸƒ

Topics

Resources

Stars

Watchers

Forks

Languages