Private
Public Access
1
0

sporttracks callback

This commit is contained in:
Sander Roosendaal
2017-05-11 20:49:57 +02:00
parent 0ae926536f
commit f03892f1c7
3 changed files with 16 additions and 11 deletions

View File

@@ -122,11 +122,18 @@ def get_token(code):
response = requests.post(url,
data=json.dumps(post_data),
headers=headers)
token_json = response.json()
thetoken = token_json['access_token']
expires_in = token_json['expires_in']
refresh_token = token_json['refresh_token']
if response.status_code == 200 or response.status_code == 201:
token_json = response.json()
thetoken = token_json['access_token']
expires_in = token_json['expires_in']
try:
refresh_token = token_json['refresh_token']
except KeyError:
refresh_token = refreshtoken
else:
return [0,0,0]
return [thetoken,expires_in,refresh_token]
# Make authorization URL including random string