mirror of
https://github.com/xcat2/confluent.git
synced 2025-02-11 08:15:24 +00:00
Simplify get_nonce
Use the helper function, for example to cope with the prospect of gzip response.
This commit is contained in:
parent
01a21ec248
commit
8ee3630aa1
@ -148,12 +148,8 @@ class NodeHandler(immhandler.NodeHandler):
|
||||
})
|
||||
headers = {'Connection': 'keep-alive',
|
||||
'Content-Type': 'application/json'}
|
||||
nonce = None
|
||||
wc.request('POST', '/api/providers/get_nonce', '{}')
|
||||
rsp = wc.getresponse()
|
||||
tokbody = rsp.read()
|
||||
if rsp.status == 200:
|
||||
rsp = json.loads(tokbody)
|
||||
rsp, status = wc.grab_json_response_with_status('/api/providers/get_nonce', {})
|
||||
if status == 200:
|
||||
nonce = rsp.get('nonce', None)
|
||||
headers['Content-Security-Policy'] = 'nonce={0}'.format(nonce)
|
||||
wc.request('POST', '/api/login', adata, headers)
|
||||
|
Loading…
x
Reference in New Issue
Block a user