bug fixes
This commit is contained in:
@@ -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']
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user