Created
January 15, 2017 09:38
-
-
Save vanne02135/6901cc2b92315881080d0ce0f07c1a17 to your computer and use it in GitHub Desktop.
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
# Demonstrate data download from Emfit API | |
# Config | |
remember_token="XXXXXXXX" # token returned from API login | |
device_id=666 # Your own device id number | |
from_date = "2017-01-01" | |
to_date = "2017-01-14" | |
# End of config | |
import json | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import requests | |
url = "https://api-qs.emfit.com/v3/trends/%d/%s/%s?remember_token=%s" | |
resp = requests.get(url % (device_id, from_date, to_date, remember_token)) | |
if not resp.ok: | |
raise Exception("Failed to fetch") | |
emfit = json.loads(resp.text) | |
df = pd.DataFrame(emfit["data"]).set_index("date") | |
df.meas_hr_min.plot() | |
df.meas_hr_min_sma.plot() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should plot something like this