Python and wapi to return host (name), ip address, and EAs for each host

[ Edited ]
Posts: 22
657     0

Complements of this forum I have a python program that returns used network percentage and various EAs.

Hello All,

I have been able to get a json object based on the script provided in "API Dummies How To Guide"

This is very helpful.  I use a similar process to get a json object based on the "record:host" object being added using the code below:

net_params = {'network_view': network_view, '_max_results': str(max_results),
'_return_fields': 'name,ipv4addrs,extattrs'}
rx = requests.get(url + 'record:host',
auth=(id, pw),

if rx.status_code !=
exit_msg = 'Error {} finding networks: {}'
sys.exit(exit_msg.format(rx.status_code, rx.reason))


This gives me a json collection with all the info I need, but I am having trouble getting the "ipv4addr".

I can get the 'name' OK and the EAs, but cannot find the key to getting the ip address out of this data;.

A typical line looks like this (from the rx.json object):

, 'configure_for_dhcp': False, 'host': '', 'ipv4addr': ''}], 'name': 'host1'},


I am not seeing how to parse the json to get the data. I am using python.


any suggestions,




If I have posted in the wrong place, please forgive me.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You