From d4f93cbd40ba3cad7826a45e8c191af39f9e02e8 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 4 May 2017 08:54:29 +0200 Subject: [PATCH] added headers --- rowers/tpstuff.py | 6 +++--- rowers/views.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rowers/tpstuff.py b/rowers/tpstuff.py index 44bc2a2c..352ecdf1 100644 --- a/rowers/tpstuff.py +++ b/rowers/tpstuff.py @@ -219,7 +219,7 @@ def uploadactivity(access_token,filename,description='', headers = { "Content-Type": "application/json", 'Accept': 'application/json', - 'authorization': 'Bearer %s' % access_token + 'Authorization': 'Bearer %s' % access_token } @@ -245,9 +245,9 @@ def uploadactivity(access_token,filename,description='', print "" print headers print "" - return 0,resp.reason,resp.status_code + return 0,resp.reason,resp.status_code,headers else: - return resp.json()[0]["Id"],"ok",200 + return resp.json()[0]["Id"],"ok",200,"" return 0 diff --git a/rowers/views.py b/rowers/views.py index 96fcf203..b1fa230c 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -1244,10 +1244,10 @@ def workout_tp_upload_view(request,id=0): if (checkworkoutuser(request.user,w)): tcxfile = tpstuff.createtpworkoutdata(w) if tcxfile: - res,reason,status_code = tpstuff.uploadactivity(r.tptoken,tcxfile, + res,reason,status_code,headers = tpstuff.uploadactivity(r.tptoken,tcxfile, name=w.name) if res == 0: - message = "Upload to TrainingPeaks failed with status code "+str(status_code)+": "+reason + message = "Upload to TrainingPeaks failed with status code "+str(status_code)+": "+reason+"\n"+headers w.uploadedtotp = -1 w.save() try: