-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with filters if filter value is Null #442
Comments
Use |
so i need to additionally keep track of the return value from the other request? It seems to me that this complicates and makes my code ugly. |
The problem/feature is apparently this (https://docs.python-requests.org/en/latest/user/quickstart/#passing-parameters-in-urls): "Note that any dictionary key whose value is @zachmoody what do you think, could we change |
By the way, if you substitute "null" in the filter, for example, in vrf_id, then there will be an error: |
I don't get why the error says about What does your Anyway, this is how it looks like here (pynetbox ~6.5.0, NetBox 3.2.0-dev):
|
Indeed, my mistake, the "null" value was passed to the "create" function: nb.ipam.prefixes.create(obj) |
I don't know, I agree it is cleaner, but I also worry it could result in some astonishing behavior for clients. E.g. someone initializing a variable that winds up getting passed to get or filter as None now has very confusing result. I think the current behavior with null is worth calling out in the docs though. |
Netbox - v3.1.6
pynetbox - 6.5.0
Repeatability I think on all versions.
Let's look at the request:
https://demo.netbox.dev/api/dcim/racks/?site_id=21&location_id=null
We'll get racks with no location.
If we try to do the same through the pynetbox library:
pynb.dcim.racks.filter(site_id=21, location_id=None)
Then we get all the racks on this site. The request will look like:
https://demo.netbox.dev/api/dcim/racks/?site_id=21
This applies to both the get request and all objects.
The text was updated successfully, but these errors were encountered: