From a4b98ed852afda8213c7f44578803ebb406ff444 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sat, 25 Feb 2017 19:50:51 +0100 Subject: [PATCH] more fancy error catching in c2stuff --- rowers/c2stuff.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rowers/c2stuff.py b/rowers/c2stuff.py index 23bf374f..676c724d 100644 --- a/rowers/c2stuff.py +++ b/rowers/c2stuff.py @@ -351,7 +351,12 @@ def get_token(code): token_json = response.json() - if token_json['status_code'] == 200: + try: + status_code = token_json['status_code'] + except KeyError: + status_code = token_json.status_code + + if status_code == 200: thetoken = token_json['access_token'] expires_in = token_json['expires_in'] refresh_token = token_json['refresh_token']