mirror of
https://opendev.org/x/pyghmi
synced 2025-01-27 19:37:44 +00:00
Support newer FPC CSRF scheme
CSRF scheme was refactored in recent FPC firmware, support the third location where the CSRF tokens might be found. Change-Id: I0a3a9310e399f77d2a40f4b9d815127b9a884d1d
This commit is contained in:
parent
da5e602cb0
commit
db7f1490f5
@ -304,6 +304,21 @@ class SMMClient(object):
|
||||
if '"ST2"' in line:
|
||||
self.st2 = line.split()[-1].replace(
|
||||
'"', '').replace(',', '')
|
||||
if not self.st2:
|
||||
wc.request('GET', '/scripts/index.ajs')
|
||||
rsp = wc.getresponse()
|
||||
body = rsp.read()
|
||||
if rsp.status != 200:
|
||||
raise Exception(body)
|
||||
for line in body.split('\n'):
|
||||
if '"ST1"' in line:
|
||||
self.st1 = line.split()[-1].replace(
|
||||
'"', '').replace(',', '')
|
||||
if '"ST2"' in line:
|
||||
self.st2 = line.split()[-1].replace(
|
||||
'"', '').replace(',', '')
|
||||
if not self.st2:
|
||||
raise Exception('Unable to locate ST2 token')
|
||||
wc.set_header('ST2', self.st2)
|
||||
return wc
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user