Are you interested in our Early Access Program (EAP)? This program allows you to preview code, test in your lab and provide feedback prior to General Availability (GA) release of all Infoblox products. If so, please click the link here.

API Examples

Reply

Convert infoblox-client call to requests

Techie
Posts: 11
264     0

I have some python code that can get A records, or CNAMES or PTR records that uses the infoblox-client, I would like to convert it to use the requests module but I am having trouble with the get request. Here is what I have for the infoblox-client:

connection has been defined already

rec_type = 'a'
search_field = 'name:~'
search_val = 'example'
kwargs = {
    'return_fields': [
        'default',
        'name',
        'ipv4addr',
        'last_queried',
    ],
    'max_results': 4096,
}
result
= connection.get_object('record:' + rec_type, {search_field: search_val}, **kwargs)
 
This works fine, how do I convert this to use the requests module? I have tried:
params = {
    search_field: search_val,
    '_return_fields':
        'name, default',
    'max_results': 4096,
}
response = requests.get(my_url + 'record:a'params=params, verify=False, auth=('infoblox, 'infoblox'))
 
but I get an error when I try to get more than 1 return field, I tried it as a list but that didn't seem to work either, I get a 400 returned.
 
Thank you!
Showing results for 
Search instead for 
Did you mean: 

Recommended for You