Private
Public Access
1
0

some more error detection code

This commit is contained in:
Sander Roosendaal
2017-01-22 20:35:51 +01:00
parent 78ea02b9b4
commit d04200d1ec
2 changed files with 22 additions and 1 deletions

View File

@@ -226,7 +226,16 @@ def createstravaworkoutdata(w):
# to rowing on Strava
def handle_stravaexport(file,workoutname,stravatoken,description=''):
# w = Workout.objects.get(id=workoutid)
client = stravalib.Client(access_token=stravatoken)
try:
client = stravalib.Client(access_token=stravatoken)
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 236\r\n")
return 0
try:
act = client.upload_activity(file,'tcx',name=workoutname)
res = act.wait(poll_interval=5.0)