Create a Post
Showing results for 
Search instead for 
Did you mean: 

Using python SDK to create host


I am trying to write a script to create a host using the python sdk, but i keep coming across this weird issue.

When i have a list of ip address, and the loop through the list and try to create the host objects like this

api_client.api_call("add-host", {"name": host_name, "ip-address": host_ip})

host_ip being the variable i am using to store the ip address in my loop

I get the following error:

message: Invalid parameter for [ip-address]. Not a valid IPv4 or IPv6 address
code: generic_err_invalid_parameter

But i take one of the ip address that i get an error with and put it in manually like this

api_client.api_call("add-host", {"name": host_name, "ip-address": ""})

it works perfect, no errors


I tried stripping the data from any extra spaces and converting to string, but still getting the same error. 


Any one else ever come across this before?

0 Kudos
1 Reply

When you print that variable, what does it show?
The error suggests the variable value is corrupt or in thr wrong format.
0 Kudos