Reply

Convert infoblox-client call to requests

Techie
Posts: 12
904     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