Private
Public Access
1
0

using v3 now

This commit is contained in:
Sander Roosendaal
2022-08-17 02:44:48 +02:00
parent a7773a6f4a
commit b88aa0a246
4 changed files with 49 additions and 3 deletions

View File

@@ -90,6 +90,8 @@ SETTINGS_NAME = settings.SETTINGS_NAME
UPLOAD_SERVICE_URL = settings.UPLOAD_SERVICE_URL
UPLOAD_SERVICE_SECRET = settings.UPLOAD_SERVICE_SECRET
NK_API_LOCATION = settings.NK_API_LOCATION
TP_CLIENT_ID = settings.TP_CLIENT_ID
TP_CLIENT_SECRET = settings.TP_CLIENT_SECRET
from requests_oauthlib import OAuth1, OAuth1Session
@@ -299,6 +301,23 @@ def summaryfromsplitdata(splitdata, data, filename, sep='|', workouttype='rower'
return sums, sa, results
@app.task
def check_tp_workout_id(workout, location, attempts=5, debug=False, **kwargs):
authorizationstring = str('Bearer ' + workout.user.tptoken)
headers = {'Authorization': authorizationstring,
'user-agent': 'sanderroosendaal',
'Content-Type': 'application/json'}
response = requests.get(location, headers=headers, params={})
if response.status_code == 200:
status = response.json()['Status']
if status == 'Success':
tpid = response.json()['WorkoutIds'][0]
workout.uploadedtotp = tpid
workout.save()
return 1
@app.task
def instroke_static(w, metric, debug=False, **kwargs):
f1 = w.csvfilename[6:-4]