strava callback catch error code
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user