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.
Last run was 0 years, 0 months, 2 days, 13 hours and 7 minutes ago!
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.
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: -
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.