Last active
February 26, 2019 18:40
-
-
Save nicokosi/ffaa47da9114a62c5d5c13e8cea7506d to your computer and use it in GitHub Desktop.
Python code that generates charts from Strava API (http://strava.github.io/api/v3/activities/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.client | |
import json | |
import getpass | |
import matplotlib.pyplot as plot | |
import pandas as pd | |
def activities(token): | |
connection = http.client.HTTPSConnection("www.strava.com") | |
connection.request("GET", "/api/v3/activities?access_token=" + token + "&per_page=200") | |
response = connection.getresponse() | |
print(response.status, response.reason) | |
return response.read() | |
a = activities( | |
getpass.getpass("Please input Strava token: ")) | |
df = pd.read_json(a) | |
df.plot() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment