Skip to content

Instantly share code, notes, and snippets.

@nicokosi
Last active February 26, 2019 18:40
Show Gist options
  • Save nicokosi/ffaa47da9114a62c5d5c13e8cea7506d to your computer and use it in GitHub Desktop.
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/)
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