当我想从python-netbox库调用get_device_by_name时出现以下错误:
“ Dcim”的实例没有“ get_device_by_name”成员
参考文档,此方法应该存在https://python-netbox.readthedocs.io/en/latest/examples.html#examples
我的代码示例:
from netbox import NetBox
class NboxM:
def __init__(self):
self.nbox = NetBox(
host='host',
port='port',
use_ssl=False,
auth_token='token'
)
self.nbox.dcim.get_device_by_name('name')
我的lib版本:python-netbox 0.0.14
答案 0 :(得分:1)
似乎他们将其删除了。您应该使用get_device_by_name('name')
而不是get_devices(name='name')
。请参阅自述文件:
https://github.com/jagter/python-netbox
通过我在存储库上创建问题的方式: