Private
Public Access
1
0

bug fixes

This commit is contained in:
Sander Roosendaal
2018-07-09 18:36:56 +02:00
parent d83e8b58ce
commit ebefc67492
3 changed files with 18 additions and 5 deletions

View File

@@ -196,7 +196,7 @@ def summaryfromsplitdata(splitdata,data,filename,sep='|'):
resttime = 0
try:
restdistance = data['rest_distance']
except keyError:
except KeyError:
restdistance = 0
try:
avghr = data['heart_rate']['average']

View File

@@ -136,10 +136,20 @@ def imports_do_refresh_token(refreshtoken,oauth_data,access_token=''):
data=post_data,
headers=headers)
token_json = response.json()
if response.status_code == 200 or response.status_code == 201:
token_json = response.json()
else:
raise NoTokenError
thetoken = token_json['access_token']
expires_in = token_json['expires_in']
try:
thetoken = token_json['access_token']
except KeyError:
raise NoTokenError
try:
expires_in = token_json['expires_in']
except KeyError:
expires_in = 0
try:
refresh_token = token_json['refresh_token']
except KeyError:
@@ -251,5 +261,5 @@ def imports_token_refresh(user,tokenname,refreshtokenname,expirydatename,oauth_d
setattr(r,refreshtokenname,refresh_token)
r.save()
return r.sporttrackstoken
return access_token

View File

@@ -168,6 +168,9 @@ def workout_tp_upload(user,w):
thetoken = tp_open(r.user)
# need some code if token doesn't refresh
if (checkworkoutuser(user,w)):
tcxfile = createtpworkoutdata(w)
if tcxfile: