netbox-community / pynetbox

Python API client library for Netbox.
Apache License 2.0
575 stars 170 forks source link

interfaces.get: raise ValueError get() returned more than one result #47

Closed tiago-cruz-movile closed 6 years ago

tiago-cruz-movile commented 6 years ago

Environment: pynetbox (3.2.0)

>>> nbmovile.dcim.interfaces.get(device='alog10')
eth0
>>> nbmovile.dcim.interfaces.get(device='mcloud8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pynetbox/lib/endpoint.py", line 161, in get
    raise ValueError('get() returned more than one result.')
ValueError: get() returned more than one result.
zachmoody commented 6 years ago

That's expected, you'll want to use .filter() if your query has the potential for more than one result.