This script fetches your strava historical data and outputs to tab separated values. You can copy into excel, or redirect into a .tsv file and import to a spreadsheet.
This script does not pull segment data, map data, or gpx data.
- This script assumes the following are installed
- python3
- homebrew
-
install pipenv if needed
brew install pipenv pipenv shell pipenv install -
if you don't have a Strava Client Application, Register for one here: https://www.strava.com/settings/api
- Tips:
- Application Name: (whatever you like)
- Category: Data Importer
- Website: http://notarealsite.com or your real url
- Description: developer
- Authorization Callback Domain: localhost:4000
- Club (skip this)
- Tips:
-
create your
client_secret.jsonfilecp client_secret.json.sample client_secret.json -
customize your
client_secret.jsonfile- fill in the
client_id(e.g. 5 digits) assigned to your registered client application - fill in your
client_secretwith the Client Secret assigned to your client application - fill in the
redirect_uriwith the fully qualified url for your Authorization Callback Domain for your client application
- fill in the
-
load environment and run
pipenv shell python3 strava_pull.py -
the first time you run this
- the file
credentials.jsonwill be saved locally - a browser will open for the authentication flow
- the file
-
to customize:
-
edit the
strava_pull.pyscript variables near the topis_celsius = False # set to True for C, False for F is_metric = False # set to True for metric, False for standard max_pages = None # set to 1 for quick test or None to get all pages -
comment out or reorder columns in
COLUMNS_ORDEREDlist to change output -
Subsequent runs will only download newest activities. To redownload all activities, delete the generated file
last_saved.txtfrom this directory.
-
-
to exit pipenv environment
exit
- lookup lat/long where city is missing
- find a more performant way to gather ride detail, like calories
- what else? drop me a line.