Gracefully handle read timeouts when communicating with BlenderID
This commit is contained in:
parent
ab7d623d27
commit
a8511c9db5
@ -114,9 +114,19 @@ def validate_token(user_id, token, oauth_subclient_id):
|
|||||||
try:
|
try:
|
||||||
r = s.post(url, data=payload, timeout=5,
|
r = s.post(url, data=payload, timeout=5,
|
||||||
verify=current_app.config['TLS_CERT_FILE'])
|
verify=current_app.config['TLS_CERT_FILE'])
|
||||||
except requests.exceptions.ConnectionError as e:
|
except requests.exceptions.ConnectionError:
|
||||||
log.error('Connection error trying to POST to %s, handling as invalid token.', url)
|
log.error('Connection error trying to POST to %s, handling as invalid token.', url)
|
||||||
return None, None
|
return None, None
|
||||||
|
except requests.exceptions.ReadTimeout:
|
||||||
|
log.error('Read timeout trying to POST to %s, handling as invalid token.', url)
|
||||||
|
return None, None
|
||||||
|
except requests.exceptions.RequestException as ex:
|
||||||
|
log.error('Requests error "%s" trying to POST to %s, handling as invalid token.', ex, url)
|
||||||
|
return None, None
|
||||||
|
except IOError as ex:
|
||||||
|
log.error('Unknown I/O error "%s" trying to POST to %s, handling as invalid token.',
|
||||||
|
ex, url)
|
||||||
|
return None, None
|
||||||
|
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
log.debug('Token %s invalid, HTTP status %i returned', token, r.status_code)
|
log.debug('Token %s invalid, HTTP status %i returned', token, r.status_code)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user