import requests
import pandas as pd
import json
YOUR_TIMEZONE = 'Asia/Singapore'
payload = {'experiment-id': 'experiment', 'weeks': '30',
'user-id': 'user01'}
# the api-key below is limited to 200 queries per day. Please
contact us to get an API key
headers = {"Accept": "application/json", 'x-api-key':
'7v90iALbXt1yRHdVomfpH80wmz14wTt92I0CR0na'}
response = requests.get(
'https://x2nwuplc8d.execute-api.us-east-1.amazonaws.com/default/read-coziePublic-fitbitAPI',
params=payload, headers=headers)
my_json = response.content.decode('utf8').replace("'", '"')
data = json.loads(my_json)
df = pd.read_json(data[1]['data']).T
df.index = df.index.tz_localize('UTC').tz_convert(YOUR_TIMEZONE)
df.head()
Please cite us if you use Cozie: Prageeth Jayathissa, Matias Quintana, Tapeesh Sood and Negin Nazarian, Clayton Miller (2019) Is your clock-face cozie? A smartwatch methodology for the in-situ collection of occupant comfort data