Skip to content

scripts for strava data πŸƒπŸΌβ€β™‚οΈ

License

Notifications You must be signed in to change notification settings

izzygomez/strava

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

75 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Strava Scripts

pre-commit

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 🚧.

Setup

See SETUP.md for setup instructions.

Usage

After completing setup, you can use the following scripts & command-line flags.

Combined Sync (Sheets + Calendar)

Use this when you want to run both sync jobs in one command:

./strava-sync.sh

This runs strava_to_pfitz_gsheet & strava_to_gcal sequentially.

  • All supported command-line flags are forwarded to both scripts.
  • --start-date, --end-date, & --timezone are optional.
  • If those three flags are omitted, strava-sync.sh uses its built-in defaults.

Run Individual Scripts

Use these commands when you only want one sync target.

strava_to_pfitz_gsheet.py

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.

strava_to_gcal.py

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.

Other scripts in scripts/

python -m scripts.{script_name}

Misc tasks that are personalized to my own use case. Not recommended for general use.

Command-line flags

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.

TODOs

  • 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.

About

scripts for strava data πŸƒπŸΌβ€β™‚οΈ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •