Skip to main content

Strava command-line interface

Build Status

Uses Strava API to access Strava dataset.

Installation

Using Homebrew on OSX:

brew tap bwilczynski/tap
brew install strava-cli

Using pip (requires Python 3):

pip install strava-cli

Usage

strava [OPTIONS] COMMAND [ARGS]

Get Started

Create application and run strava config to provide your application's Client ID and Client Secret.

Alternatively set the following environment variables before running strava:

export STRAVA_CLIENT_ID={YOUR_CLIENT_ID}
export STRAVA_CLIENT_SECRET={YOUR_CLIENT_SECRET}

Login to your Strava service (opens a web browser sending user to Strava login service):

strava login

For usage and help content, pass in the --help parameter, for example:

strava --help

Available commands

Get recent, yearly, total stats:

➜ strava stats  

Type        Count  Distance    Moving time    Elevation gain
--------  -------  ----------  -------------  ----------------
🏃 recent        7  53.33 km    5h 6m          166 m
🏃 ytd         121  1048.15 km  95h 43m        4526 m
🏃 all         241  1761.13 km  164h 35m       7258 m

Get last 5 activities:

➜ strava activities -pp 5

        Id  Start date                 Name             Elapsed time    Distance    Average speed
----------  -------------------------  ---------------  --------------  ----------  ---------------
2038696223  2018-12-27 17:58:49+01:00  🏃 Afternoon Run  45:19           8.02 km     05:15 /km
2034884699  2018-12-25 15:38:55+01:00  🏃 Bday Run       44:56           7.32 km     05:41 /km
2031636166  2018-12-23 14:29:50+01:00  🏃 Afternoon Run  48:14           6.55 km     06:17 /km
2030237887  2018-12-22 20:13:31+01:00  🏃 Evening Run    37:34           7.10 km     05:16 /km
2020398424  2018-12-16 16:39:56+01:00  🏃 Afternoon Run  41:54           6.31 km     05:43 /km

Get activities after / before a certain date:

strava activities --after="2 weeks ago" --before="1 week ago"
strava activities --after="2018-12-01"

Get detailed activity information:

➜ strava activity 1958241710

Name:                  🏃 30. Bieg Niepodległości
Description:           Oficjalny czas: 46:55
Start date:            2018-11-11 11:24:28+01:00
Elapsed time:          46:58
Distance:              10.02 km
Average speed:         04:41 /km
Total elevation gain:  52 m
Calories:              639.0
Device name:           Garmin Forerunner 645 Music
Gear:                  New Balance Zante v4 (443.65 km)
Split 1:               👟 04:44 /km ❤ 164 bpm ⬆ 7 m
Split 2:               👟 04:38 /km ❤ 168 bpm ➡ 0 m
Split 3:               👟 04:48 /km ❤ 164 bpm ⬆ 1 m
Split 4:               👟 04:49 /km ❤ 160 bpm ⬇ -3 m
Split 5:               👟 04:41 /km ❤ 161 bpm ⬇ -2 m
Split 6:               👟 04:37 /km ❤ 164 bpm ⬆ 2 m
Split 7:               👟 04:50 /km ❤ 165 bpm ⬆ 3 m
Split 8:               👟 04:39 /km ❤ 163 bpm ⬇ -1 m
Split 9:               👟 04:42 /km ❤ 165 bpm ➡ 0 m
Split 10:              👟 04:24 /km ❤ 171 bpm ⬇ -9 m
Split 11:              👟 04:44 /km ❤ 173 bpm ⬇ -1 m

Or use xargs:

strava activities -q --after="1 day ago" | xargs strava activity 

Combine JSON output with jq:

➜ strava activities -pp 1 -q | xargs strava activity --output json | jq ".name"
"Afternoon Run"

Upload Activity from GPX (example: export from a competing service):

strava upload ./2020-09-27-145141.gpx
Id:      4717164254
Status:  Your activity is still being processed.
Error:   None

Can upload multiple activities.

strava upload ./*.gpx

Release files for strava-cli 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strava-cli 0.7.0
File Size Uploaded
strava-cli-0.7.0.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for strava-cli 0.7.0
File Interpreter ABI Platform
strava_cli-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size:33.5 kB

Release files / strava-cli-0.7.0.tar.gz

Download URL strava-cli-0.7.0.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d55bf4fe4935c3a86426aa5497cf8b3ef58ec0a58194c0b7e12f7e5aef757c2d
BLAKE2b-256 checksum
How to use checksums
e49e7cc17ee2c057ffaf792b32823abe7c8762c94581aa5f399883990fd3e493
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / strava_cli-0.7.0-py3-none-any.whl

Download URL strava_cli-0.7.0-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8529f0610209a5237547a96507f81dfd1f29a69f024994fd696fcc0535a57481
BLAKE2b-256 checksum
How to use checksums
afd43c2ac87106cb4ef6abed42c3f8e51b4d50aba7c2937835750fc9dcf305da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page