Private
Public Access
1
0

works except for target cadence

This commit is contained in:
Sander Roosendaal
2021-05-16 07:30:56 +02:00
parent acc4c6f305
commit 54190ed383
3 changed files with 225 additions and 66 deletions

View File

@@ -28,23 +28,24 @@ payload = {
'workoutSourceId': 'Rowsandall.com',
'steps': [
{
'type': 'WorkoutStep', 'stepOrder': 0,
'type': 'WorkoutStep',
'stepOrder': 0,
#'repeatType': 'Step',
'repeatValue': 1,
#'repeatValue': 1,
'intensity': 'ACTIVE',
'description': '0',
'description': 'At 220W',
'durationType': 'TIME',
'durationValue': 1800,
'durationValueType': 'METER',
'durationValueType': None,
'targetType': 'POWER',
'targetValue': 1226,
'targetValue': 226,
'targetValueLow': None,
'targetValueHigh': None,
}
]
}
payload = {
payload2 = {
"workoutName": "Test",
"description": "Test",
"sport": "CYCLING",
@@ -55,16 +56,93 @@ payload = {
"intensity": "INTERVAL",
"description": "Free Ride",
"durationType": "TIME",
"durationValue": 300,
"durationValue": 1800,
"durationValueType": None,
"targetType": "POWER",
"targetValue": None,
"targetValueLow": 0,
"targetValueHigh": 0.7,
"targetValueType": "PERCENT",
"targetValue": 226,
"targetValueLow": None,
"targetValueHigh": None,
"targetValueType": None,
"exerciseCategory": None
}]}
payload = {'workoutName': '4x1000m',
'sport': 'GENERIC',
'description': 'Uploaded from Rowsandall.com',
'estimatedDurationInSecs': 2700,
'estimatedDistanceInMeters': 8768,
'workoutProvider': 'Rowsandall.com',
'workoutSourceId': 'Rowsandall.com',
'steps': [{'type': 'WorkoutStep',
'stepOrder': 0,
'repeatType': None,
'repeatValue': 1,
'intensity': 'INTERVAL',
'description': '0',
'durationType': 'DISTANCE',
'durationValue': 2000,
'durationValueType': 'METER',
'targetType': None,
'targetValue': None,
'targetValueLow': None,
'targetValueHigh': None},
{'type': 'WorkoutRepeatStep',
'stepOrder': 1,
'repeatType': 'REPEAT_UNTIL_STEPS_CMPLT',
'repeatValue': 4,
'intensity': 'INTERVAL',
'description': '3',
'durationType': 'REPS',
'durationValue': None,
'durationValueType': None,
'targetType': None,
'targetValue': None,
'targetValueLow': None,
'targetValueHigh': None,
'steps': [{'type': 'WorkoutStep',
'stepOrder': 2,
'repeatType': None,
'repeatValue': 1,
'intensity': 'INTERVAL',
'description': '1',
'durationType': 'DISTANCE',
'durationValue': 1000,
'durationValueType': 'METER',
#'targetType': 'CADENCE',
#'targetValue': 25,
#'targetValueLow': None,
#'targetValueHigh': None
},
{'type': 'WorkoutStep',
'stepOrder': 3,
'repeatType': None,
'repeatValue': 1,
'intensity': 'REST',
'description': '2',
'durationType': 'TIME',
'durationValue': 60,
'durationValueType': None,
'targetType': None,
'targetValue': None,
'targetValueLow': None,
'targetValueHigh': None}]},
{'type': 'WorkoutStep',
'stepOrder': 4,
'repeatType': None,
'repeatValue': 1,
'intensity': 'INTERVAL',
'description': '4',
'durationType': 'DISTANCE',
'durationValue': 2000,
'durationValueType': 'METER',
'targetType': None,
'targetValue': None,
'targetValueLow': None,
'targetValueHigh': None}]}
print(json.dumps(payload))
@@ -95,4 +173,17 @@ response = requests.post(url,auth=authheaders,json=payload)
# build base_string
print(response.status_code)
print(response.text)
print(response.json())
garmin_workout_id = response.json()['workoutId']
url = 'http://apis.garmin.com/training-api/schedule'
payload = {
'workoutId': garmin_workout_id,
'date': '2021-05-16'
}
response = requests.post(url,auth=authheaders,json=payload)
print(response.status_code)
print(response.json())