-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Invalid URL for paged requests #88
Comments
As a quick test, this seems to work, but I'm probably overlooking something.
|
next_url = "{}{}limit={}&offset={}".format(
self.url,
'&' if self.url[-1] != '/' else '?',
req['count'],
len(req['results'])
) if first_run else req['next'] ^ I had to go way back for this this one, but iirc this is an optimization. Just dropping |
Sorry, it looks like I left out a critical detail, which I didn't initially realize was relevant. The paging works fine when calling My use case is to provide a CLI for NetBox, and commands like
|
Ohhh, I see. Wondering if empty kwargs there should raise an Exception or if we should add a trailing slash to |
Well, selfishly, my vote is for the latter, as I wouldn't have to change my code. :-D |
haha, does |
If I hit an endpoint with few enough results that paging isn't required, |
ah, right. Let me mull it over. You bring up a good point - it'd probably be a major version bump if we raised an exception, and there's a few other changes queued up for that. |
Raise a ValueError when kwargs for filter() is empty to keep a uniform API and prevent the issues seen in issue #88.
Raise a ValueError when kwargs for filter() is empty to keep a uniform API and prevent the issues seen in issue #88.
Raise a ValueError when kwargs for filter() is empty to keep a uniform API and prevent the issues seen in issue #88.
pynetbox is building a URL for subsequent requests when paging that is invalid, i.e.
/api/virtualization/virtual-machines&limit=112&offset=50
.Should pynetbox just use the
next
field?The text was updated successfully, but these errors were encountered: