pynetbox icon indicating copy to clipboard operation
pynetbox copied to clipboard

Fix for limit without offset being ignored

Open mrkeathley opened this issue 3 years ago • 0 comments

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

mrkeathley avatar Aug 18 '22 22:08 mrkeathley