Skip to content

Latest commit

 

History

History
62 lines (36 loc) · 4.13 KB

README.md

File metadata and controls

62 lines (36 loc) · 4.13 KB

StravaDataAnalysis

Simple data extract from the Strava API to generate some data points I'm interested in. If other people start using this, I'll try and streamline this process as much as I can.

License: Unlicense CodeFactor Codacy Badge GenerateStats CodeQL

Generated Content

Last run was 0 years, 0 months, 7 days, 3 hours and 44 minutes ago!

Running Pace vs Elevation Change

Time Taken per Distance

Running Pace over Time

Running Pace vs Total Distance on that run

Number of Runs per Distance

Fastest 1k Pace over Time

Total Distance Run each month by year

Pace by day

Activity Heatmap

Cumulative Distance Run per year

Weekly Distance Run per year

VO₂ Max Over Time

Monthly Consistency Analysis

Instructions

As I'm sure is obvious, I'm teaching myself python as I go so the code quality is not likely to be great. Do with it as you wish.

1.To use, create an Application on Strava. This can be done here: https://www.strava.com/settings/api Give it a name, a website and an "Authorization Callback Domain". The "Authorization Callback Domain" should be "local host".

2.Copy and paste the following link into your browser, replacing {CLIENTIDHERE} with your numeric Client ID found on your Strava application settings page.

http://www.strava.com/oauth/authorize?client_id={CLIENTIDHERE}&response_type=code&redirect_uri=http://localhost/exchange_token&approval_prompt=force&scope=profile:read_all,activity:read_all

Click authorise when you visit the above link

3.You will go to a 404 not found page with a link that looks like this: -

http://localhost/exchange_token?state=&code={LONGCODEHERE}&scope=read,activity:read_all,profile:read_all

Copy the code after "&code=" to save for step 4.

4.Open "getTokens.py", paste your code from step 3 to the variable "copied_code". Add the client_id from your Application on Strava to the client_id variable. Add the client_secret from your Application on Strava to the client_secret variable. Save the changes.

5.Run "getTokens.py". This will create the initial tokens required for the script.

6.Open "refreshTokens.py", add the client_id from your Application on Strava to the client_id variable. Add the client_secret from your Application on Strava to the client_secret variable. Save the changes.

Once this has been completed, you can run "getData.py" which uses the tokens to get the data points. If the access_token has expired, it will use the refresh_token to get a new token.