Useful scripts for working with Strava data. A lot of functionality is based on my own personal use cases, but for the most part everything is written generically & with appropriate setup instructions to be adapted by others. Do note, though, that a lot of code here is still a π§ work-in-progress π§.
See SETUP.md for setup instructions.
After completing setup, you can use the following scripts & command-line flags.
Use this when you want to run both sync jobs in one command:
./strava-sync.shThis runs strava_to_pfitz_gsheet & strava_to_gcal sequentially.
- All supported command-line flags are forwarded to both scripts.
--start-date,--end-date, &--timezoneare optional.- If those three flags are omitted,
strava-sync.shuses its built-in defaults.
Use these commands when you only want one sync target.
python -m scripts.strava_to_pfitz_gsheet --start-date {s} --end-date {e} --timezone {tz} [OTHER_FLAGS...]Converts Strava activities into clickable links in the Google Sheets training log. Requires --start-date, --end-date, & --timezone. For an example, see the rightmost column of izzy.gg/vancouver25.
python -m scripts.strava_to_gcal --start-date {s} --end-date {e} --timezone {tz} [OTHER_FLAGS...]Creates Google Calendar events for Strava activities on the configured calendar. Requires --start-date, --end-date, & --timezone.
python -m scripts.{script_name}
Misc tasks that are personalized to my own use case. Not recommended for general use.
Scripts called by ./strava-sync.sh support the following flags:
| Flag | Short | Value | Description |
|---|---|---|---|
--start-date |
-s |
YYYY-MM-DD |
Start date of the sync range, inclusive. |
--end-date |
-e |
YYYY-MM-DD |
End date of the sync range, inclusive. |
--timezone |
-t |
LOCAL, ET, PT, CT, MT, UTC |
Timezone used when parsing date arguments. |
--force-refresh |
-f |
- | Bypass the Strava activity cache & fetch fresh data from the API. |
--notify-all |
-n |
- | Send ntfy.sh success notifications in addition to failure notifications. |
- Write script to automatically text me ~1 hr after running activity upload if I didn't specify gear (i.e. shoes).
- Figure out how to automatically trigger scripts when new activities are uploaded to Strava using webhooks.
- Add command-line flag for dry run mode.
- Add rate-limiting to Strava API calls to gracefully handle 429 errors.