Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Convert infoblox-client call to requests
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 06:37 AM
862     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)
'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!