I can't figure out why this line of code
out = conn.send_command("show ip interface brief", use_genie=True)
is returning a string instead of dictionary as expected. how can I fix that.
Here the whole code:
from netmiko import ConnectHandler`
import pprint
connection_info = {
'device_type': 'cisco_ios',
'host': '131.226.`enter code here`217.149',
'port': 22,
'username': 'developer',
'password': 'C1sco12345'
}
with ConnectHandler(**connection_info) as conn:
out = conn.send_command_timing("show ip interface brief", use_genie=True)
pprint.pprint(out)
for interface in out.keys():
print(interface)
Running this code produces an error:
Traceback (most recent call last):
File "get_interfaces.py", line 17, in <module>
for interface in out.keys():
AttributeError: 'str' object has no attribute 'keys'
On python interpreter, I confirmed that out is a string
>>> type(out)
<class 'str'>
>>>
Thank you for your help. Regards