From 91d6175472970fdaa8fefb55bd89f4eddba0e482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 31 Mar 2016 11:16:27 +0200 Subject: [PATCH] When BlenderID is unreachable, log an error and handle as not logged in. --- pillar/application/utils/authentication.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pillar/application/utils/authentication.py b/pillar/application/utils/authentication.py index 7fc7a8a8..a13ad6f1 100644 --- a/pillar/application/utils/authentication.py +++ b/pillar/application/utils/authentication.py @@ -32,12 +32,14 @@ def validate(token): log.debug("Validating token %s", token) payload = dict( token=token) + url = "{0}/u/validate_token".format(blender_id_endpoint()) + try: - url = "{0}/u/validate_token".format(blender_id_endpoint()) log.debug('POSTing to %r', url) r = requests.post(url, data=payload) except requests.exceptions.ConnectionError as e: - raise e + log.error('Connection error trying to POST to %s, handling as invalid token.', url) + return None if r.status_code != 200: log.info('HTTP error %i validating token: %s', r.status_code, r.content)