Jan-21-2024, 09:14 AM
Hi All,
I have python code written using netmiko library which does SSH to a switch and run the command "show env power | json". I need to convert this out put to json format so that I can track individual keys to check the power supply status.
I have python code written using netmiko library which does SSH to a switch and run the command "show env power | json". I need to convert this out put to json format so that I can track individual keys to check the power supply status.
arista_commands = ["show env power | json"] print("Device is Arista") for command in arista_commands: print("No of working PSU's on: " + ssh1.send_command(command)) psu_data = json.loads(ssh1.send_command(command))
Error:Traceback (most recent call last):
File "/home/smulgund/device_psu_test.py", line 33, in <module>
psu_data = json.loads(ssh1.send_command(command))
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)