Private
Public Access
1
0

adding plannedsession write to fit

This commit is contained in:
Sander Roosendaal
2021-02-23 19:17:03 +01:00
parent dbdbc1b906
commit 197d6c9464
2 changed files with 25 additions and 3 deletions

View File

@@ -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