Private
Public Access
1
0

strava callback catch error code

This commit is contained in:
Sander Roosendaal
2017-02-17 07:33:27 +01:00
parent dd280df523
commit 5c81734d63
2 changed files with 15 additions and 8 deletions

View File

@@ -85,8 +85,11 @@ def get_token(code):
response = requests.post("https://www.strava.com/oauth/token",
data=post_data,
headers=headers)
token_json = response.json()
thetoken = token_json['access_token']
try:
token_json = response.json()
thetoken = token_json['access_token']
except KeyError:
thetoken = 0
return [thetoken]