Moved TLS cert file to post() call instead of session.
Another way to make it work is to set it on the session, and explicitly specify verify=True in the post() call.
This commit is contained in:
parent
c79c39c9e5
commit
a5e92e1d87
@ -170,12 +170,12 @@ def validate_token(user_id, token, oauth_subclient_id):
|
|||||||
# Retry a few times when POSTing to BlenderID fails.
|
# Retry a few times when POSTing to BlenderID fails.
|
||||||
# Source: http://stackoverflow.com/a/15431343/875379
|
# Source: http://stackoverflow.com/a/15431343/875379
|
||||||
s = requests.Session()
|
s = requests.Session()
|
||||||
s.verify = current_app.config['TLS_CERT_FILE']
|
|
||||||
s.mount(blender_id_endpoint(), HTTPAdapter(max_retries=5))
|
s.mount(blender_id_endpoint(), HTTPAdapter(max_retries=5))
|
||||||
|
|
||||||
# POST to Blender ID, handling errors as negative verification results.
|
# POST to Blender ID, handling errors as negative verification results.
|
||||||
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'])
|
||||||
except requests.exceptions.ConnectionError as e:
|
except requests.exceptions.ConnectionError as e:
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user