Private
Public Access
1
0
This commit is contained in:
2024-03-13 18:57:18 +01:00
parent 4b83a251db
commit 5149f08de7
9 changed files with 97 additions and 228 deletions

View File

@@ -1823,15 +1823,18 @@ class InstantPlan(models.Model):
authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN
url = settings.WORKOUTS_FIT_URL+"/trainingplan/"
headers = {'Authorization': authorizationstring}
response = requests.post(url=url, headers=headers, data=yamltext)
if response.status_code == 200:
data = response.json()
self.yaml.name = data['filename']
self.uuid = data['ID']
self.name = data['name']
self.description = data['description']
self.duration = data['duration']
self.yaml = None
try:
response = requests.post(url=url, headers=headers, data=yamltext)
if response.status_code == 200:
data = response.json()
self.yaml.name = data['filename']
self.uuid = data['ID']
self.name = data['name']
self.description = data['description']
self.duration = data['duration']
self.yaml = None
except:
pass
super(InstantPlan, self).save(*args, **kwargs)