I think the problem is the boolean comparison of i.find(h['path'])
. It checks if that element has children, and it only happens in <osclass>
. You have to check if it's null, comparing to None
, like:
...
e = i.find(h['path'])
if e is not None: print(e.get(h['el']))
...
It yields:
192.168.1.5
host1.example.com
Linux