Private
Public Access
1
0

Code to check Strava behaviour

This commit is contained in:
Sander Roosendaal
2016-12-27 08:50:57 +01:00
parent 51c9915044
commit 6b20e1c936
2 changed files with 23 additions and 8 deletions

View File

@@ -247,13 +247,20 @@ def createstravaworkoutdata(w):
def handle_stravaexport(file,workoutname,stravatoken,description=''):
# w = Workout.objects.get(id=workoutid)
client = stravalib.Client(access_token=stravatoken)
act = client.upload_activity(file,'tcx',name=workoutname)
res = act.wait(poll_interval=5.0)
try:
act = client.upload_activity(file,'tcx',name=workoutname)
res = act.wait(poll_interval=5.0)
# description doesn't work yet. Have to wait for stravalib to update
act = client.update_activity(res.id,activity_type='Rowing',description=description)
# description doesn't work yet. Have to wait for stravalib to update
act = client.update_activity(res.id,activity_type='Rowing',description=description)
except:
with open("media/stravaerrors.log","a") as errorlog:
errorstring = str(sys.exc_info()[0])
timestr = time.strftime("%Y%m%d-%H%M%S")
errorlog.write(timestr+errorstring+"\r\n")
errorlog.write("stravastuff.py line 262\r\n")
# w.uploadedtostrava = res.id