- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
python create ipam host without dns
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2019 08:08 AM
hello ,
I am trying to create ipam hosts by using python requests.I am using following code but i am getting Arguments can not be repeated (ipv4addrs) error.
I looked at some topics but advised workarounds not working. Could you please tell me why i am getting this error?
param={"ipv4addrs": [{"configure_for_dhcp": False,"ipv4addr": ip}],'configure_for_dns':False,"name": "fqdn"}
rest_url="https://manager/wapi/v1.0/record:host"
r=requests.post(url=rest_url, auth=(user2,passw2),headers=header,params=param,verify=False)
Re: python create ipam host without dns
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2019 11:35 PM
Hi,
Here is a sample python code to create a host record.
import requests requests.packages.urllib3.disable_warnings() # Disable SSL warnings in requests # url = "https://127.0.0.1/wapi/v2.10/record:host?_return_as_object=1" payload = "{\"name\":\"host.info.com\",\"ipv4addrs\": [{\"configure_for_dhcp\":false,\"ipv4addr\":\"172.26.1.20\"}],\"configure_for_dns\":false}" headers = {'content-type': "application/json"} response = requests.request("POST", url, auth=('admin', 'Infoblox'), data=payload, headers=headers, verify=False) print(response.text)
Hope this helps,
Krishna Vasudevan
Re: python create ipam host without dns
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2019 04:29 PM - edited 08-28-2019 04:29 PM
Hello ,
When use your sample code i am getting this following error:
{ "text": "Unknown argument/field: '{\"name\":\"host.info.com\",\"ipv4addrs\": [{\"configure_for_dhcp\":false,\"ipv4addr\":\"10.104.50.1\"}],\"configure_for_dns\":false}'", "code": "Client.Ibap.Proto", "Error": "AdmConProtoError: Unknown argument/field: '{\"name\":\"host.info.com\",\"ipv4addrs\": [{\"configure_for_dhcp\":false,\"ipv4addr\":\"10.104.50.1\"}],\"configure_for_dns\":false}'" }
Can you share with me your python and requests version?
Thanks for your help.