netbox-community / pynetbox

Python API client library for Netbox.
Apache License 2.0
543 stars 167 forks source link

Type Problems #546

Closed Pedromdsn closed 10 months ago

Pedromdsn commented 1 year ago

I don't have access to pynetbox typings, when I try to access a device it says that the function always returns null. Although it worked I believe it was a good addition.

image

image

abhi1693 commented 1 year ago

Try this because the .get() does not know what 1 means without its identifier

device = nb.dcim.device.get(id=1)
print(device.name)

Note the above will only work if a device with ID=1 exists, otherwise you will get None and print will throw an error.

Pedromdsn commented 1 year ago

Try this because the .get() does not know what 1 means without its identifier

device = nb.dcim.device.get(id=1)
print(device.name)

Note the above will only work if a device with ID=1 exists, otherwise you will get None and print will throw an error.

Even so, just understand as Nome, doesn't give me the typing. image

abhi1693 commented 1 year ago

This library does not have any typings. It depends on the API schema that NetBox provides.

Pedromdsn commented 1 year ago

This library does not have any typings. It depends on the API schema that NetBox provides.

Wouldn't it be possible to add typing? Not even putting an object type. The code works but I keep getting an error in VSCode