pynetbox
pynetbox copied to clipboard
Fix for limit without offset being ignored
If the limit kwarg is passed without an offset it will functionally be ignored and the entire result set will be returned.
Previously:
tenants = netbox_api.tenancy.tenants.all(limit=50)
print(f'Limit Size: {tenants.request.limit}')
print(f'Length of Iterable: {len(tenants)}')
...
Limit Size: 50
Length of Iterable: 5409
The simple fix was to provide only the results from netbox when limit or offset were provided. This fixes the output:
Limit Size: 50
Length of Iterable: 50