mirror of
https://opendev.org/x/pyghmi
synced 2025-01-27 19:37:44 +00:00
Support newer TSM level
Newer TSM requires JSON rather than form encoded auth. Try the newer method and fallback to form for compatibility. Change-Id: Ic0fd8fe949eb0bc328c57038e998d8c9570e7054
This commit is contained in:
parent
00a4780220
commit
0c20d79a8c
@ -128,7 +128,12 @@ class TsmHandler(generic.OEMHandler):
|
||||
'password': self.password,
|
||||
}
|
||||
wc = webclient.SecureHTTPConnection(self.tsm, 443, verifycallback=self._certverify, timeout=180)
|
||||
rsp, status = wc.grab_json_response_with_status('/api/session', urlencode(authdata))
|
||||
wc.set_header('Content-Type', 'application/json')
|
||||
rsp, status = wc.grab_json_response_with_status('/api/session', authdata)
|
||||
if status == 403:
|
||||
wc.set_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||
rsp, status = wc.grab_json_response_with_status('/api/session', urlencode(authdata))
|
||||
|
||||
if status < 200 or status >= 300:
|
||||
raise Exception('Error establishing web session')
|
||||
self.csrftok = rsp['CSRFToken']
|
||||
|
Loading…
x
Reference in New Issue
Block a user