fixin fitbit collector

This commit is contained in:
2022-01-14 13:35:09 -05:00
parent 28040a922b
commit ce64bc554d
2 changed files with 17 additions and 12 deletions

View File

@@ -112,6 +112,7 @@ def _get_api_call():
# # Sleep between two dates
# sleep_dates = '/1.2/user/-/sleep/date/2020-04-13/2020-04-17.json'
weight = '/1.2/user/-/body/log/weight/date/' + str(date_start) + '/' + str(date_end) + '.json'
# print("API:", weight)
return weight
@@ -229,13 +230,14 @@ def run():
for sheetrow in sheet_values:
if sheetrow[0] == row["date"]:
row_exists = 1
# print(row)
if row_exists == 0:
if 'fat' in row.keys():
row_list = [row["date"],row["weight"],row["fat"],row["bmi"]]
else:
row_list = [row["date"],row["weight"],"0",row["bmi"]]
values.append(row_list)
pprint(date_start)
# pprint(date_start)
pprint(values)
UpdateSheet(values)
# sheet_values = ReadSheet()
@@ -243,18 +245,21 @@ def run():
if __name__ == '__main__':
date_start = date.today() - timedelta(31)
# date_end = date.today()
# run()
date_start = date.today() - timedelta(10)
date_end = date.today()
print("Grabbin': ", date_start, date_end)
run()
###Bulk import
# date_start = date(2015, 8, 1)
end_date = date(2019, 10, 1)
# end_date = date(2021, 11, 1)
while date_start != end_date:
# date_end = date.today() + timedelta(30)
date_end = date_start + timedelta(30)
# date_start = date.today() - timedelta(31)
run()
# time.sleep(60)
date_start = date_start - timedelta(29)
# while date_start != end_date:
# # date_end = date.today() + timedelta(30)
# date_end = date_start + timedelta(30)
# print(date_start, date_end)
# # date_start = date.today() - timedelta(31)
# # run()
# # time.sleep(10)
# date_start = date_start - timedelta(1)

Binary file not shown.