-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
I noticed that the library does nothing with the provided next field of the api, and therefor stays quiet about the fact that not all values were returned.
Can something be added (an extra key for example) which automatically request the next url (based on the next field) and add it to the to return list.
https://127.0.0.1/api/ipam/prefixes/
HTTP 200 OK
Allow: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"count": 1160,
"next": "https://127.0.0.1/api/ipam/prefixes/?limit=1000?offset=1000",
https://127.0.0.1/api/ipam/prefixes/?limit=1000?offset=1000
HTTP 200 OK
Allow: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"count": 1160,
"next": "https://127.0.0.1/api/ipam/prefixes/?limit=1000&offset=2000",
"previous": "https://127.0.0.1/api/ipam/prefixes/?limit=1000",
I now do this as temporary solution
prefixes = []
offset_num = 0
while 1:
templist = netbox.ipam.get_ip_prefixes(offset=offset_num)
if templist:
prefixes.extend(templist)
offset_num += 1000
templist = []
else:
break
The loop continues until an empty list is returned, which requires an extra unnecessary api call.
Metadata
Metadata
Assignees
Labels
No labels