Comments (5)
Hi, sorry, didn't see this come through. PATCH support is coming, probably via an .update()
method, but PUT should work. Have a look at the response docs for how to manipulate an object. Basically, you'll want to .get()
change the attributes via assignment (e.g. device.name = 'test'
) then call .save()
to send the PUT.
from pynetbox.
@zachmoody Something like this?
>>> test3 = nb.virtualization.virtual_machines.get(201)
>>> test3.name = "newname"
>>> test3.save()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/konaya/.local/lib/python3.6/site-packages/pynetbox/lib/response.py", line 233, in save
if req.put(self.serialize()):
File "/home/konaya/.local/lib/python3.6/site-packages/pynetbox/lib/query.py", line 242, in put
raise RequestError(req)
pynetbox.lib.query.RequestError: The request failed with code 500 Internal Server Error
>>>
from pynetbox.
Yeah, that should work. I don't have an easy way of seeing what that endpoint expects at the moment, but you can catch the RequestError
with something like:
from pynetbox import RequestError
try:
test3.save()
except RequestError as err:
raise Exception(err.error)
to get the response from NetBox.
from pynetbox.
Huh.
<pre><strong><class 'TypeError'></strong><br />
int() argument must be a string, a bytes-like object or a number, not 'dict'</pre>
from pynetbox.
The original request object is also returned in the exception as the .req
attribute. I'd have to go digging around in the requests
docs to find it, but you should be able to see the body of the request and maybe pick out where the errant dict is from that.
from pynetbox.
Related Issues (20)
- netbox ipam create ip address doesnot work
- 500 Internal Server Error when creating custom field
- I suspect that when filtering VLANS, the Exception is not Raised on an error message. HOT 2
- Incompatible Exception usage HOT 9
- Tests failing
- pynetbox import error importlib.metdata python3.6 HOT 3
- Add support for NetBox v3.6 HOT 1
- readthedocs doesn't show endpoints like DCIM
- Device object has no attribute "render_config" HOT 1
- Can't reset object attribute to its initial value.
- render_config tries wrong url when Netbox is behind reverse proxy HOT 1
- Choices are not returned when the API token can PUT but not POST on an endpoint HOT 4
- Keep getting Connection Reset HOT 2
- Add `vpn` app for NetBox 3.7 compatibility
- pynetbox greater than 7.0.0 fails to insert complex custom_fields HOT 1
- Add classifier and testing for Python 3.12 HOT 2
- object.update Not working for ip_Addresses HOT 1
- The limit key isn't reducing the number of results HOT 5
- Auth fails getting API version with Netbox 4.0.0 HOT 6
- Get filtering on non existent device_id raises RequestError when it should return None HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pynetbox.