Forum Discussion
Jason_Nance
May 24, 2018Nimbostratus
As Niels said, you need to strip off the
chassis-power-supply-status-index
part:
!/usr/bin/env python3
import pprint
import requests
requests.packages.urllib3.disable_warnings()
s = requests.Session()
s.auth = ('username', 'password')
r = s.get('https://hostname/mgmt/tm/sys/hardware', verify=False)
pprint.pprint(r.json())
You can deduce this by looking at the TMSH command to pull this information:
tmsh show sys hardware
(there isn't a chassis-power-supply-status-index
argument).
But once you have the JSON you can pull the info directly from there.