- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Multiple Object in Python
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2020 02:46 AM
Hi!
I need help with one case. I would like to get all hosts from some network where i have name of this network.
I work with Python. I also see that in infoblox is option to use multiple object method but i dont know how to use it with Python:/
some example:
curl -k -u admin:infoblox -H ‘content-type:application/json’ -X POST “https://127.0.0.1/wapi/v2.10/request” – d ‘[{“method”: “STATE:ASSIGN”,”data”:{“member_name”:”member1.localdomain”}},{“method”:”GET”,”object”: “member:dhcpproperties”,”data”: {“host_name”:”##STATE:member_name:##”},”assign_state”: {“host_ref”: “_ref”},”enable_substitution”: true,”discard”: true},{ “method”: “PUT”, “object”: “##STATE:host_ref:##”,”enable_substitution”: true,”data”: {“enable_dhcp”:true}},{“method”: “STATE: DISPLAY”}]’
how to transfer this to:
It will be realy helpfull if anyone could give me any of example how to use this method.
Best regards,
Filip
Re: Multiple Object in Python
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2020 10:59 PM
Hi,
Could you please try this and see if it works for your specific request?
import requests requests.packages.urllib3.disable_warnings() # Disable SSL warnings in requests # url = "https://127.0.0.1/wapi/v2.7/request" payload = "[{\"method\": \"GET\",\"object\": \"network\",\"data\": {\"name\":\"ABC\"}, \"args\":{\"_return_fields\":\"comment,disable,members,enable_ddns,network,extattrs\"},{\"_return_as_object\":1}}]" headers = {'content-type': "application/json"} response = requests.request("POST", url, auth=('uname', 'pwd'), data=payload, headers=headers, verify=False)
Regards,
Krishna