adding plannedsession write to fit
This commit is contained in:
@@ -546,9 +546,9 @@ def allsundays(startdate,enddate):
|
||||
|
||||
def steps_read_fit(filename,name='',sport='Custom'):
|
||||
authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN
|
||||
url = settings.WORKOUTS_FIT_URL
|
||||
url = settings.WORKOUTS_FIT_URL+"/tojson"
|
||||
headers = {'Authorization':authorizationstring}
|
||||
|
||||
|
||||
response = requests.post(url=url,headers=headers,json={'filename':filename})
|
||||
|
||||
if response.status_code != 200:
|
||||
@@ -561,3 +561,21 @@ def steps_read_fit(filename,name='',sport='Custom'):
|
||||
return None
|
||||
|
||||
return d
|
||||
|
||||
def steps_write_fit(filename,steps):
|
||||
authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN
|
||||
url = settings.WORKOUTS_FIT_URL+"/tofit"
|
||||
headers = {'Authorization':authorizationstring}
|
||||
|
||||
response = requests.post(url=url,headers=headers,json=steps)
|
||||
|
||||
if response.status_code != 200:
|
||||
return None
|
||||
|
||||
w = response.json()
|
||||
try:
|
||||
filename = w['filename']
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
return filename
|
||||
|
||||
Reference in New Issue
Block a user