netbox-community / pynetbox

Python API client library for Netbox.
Apache License 2.0
567 stars 168 forks source link

Update __repr__() method #544

Closed nautics889 closed 1 year ago

nautics889 commented 1 year ago

It'd be good to see more verbose info in representation of Record object. Currently __repr__() return the same as __str__() (either "name" or "label" or "display").

It should rather look like:

<pynetbox.core.response.Record ('some_record') at mem_location>

Similar to https://github.com/nautobot/pynautobot/issues/67 from pynautobot tool

abhi1693 commented 1 year ago

I don't think it is good to change for Record.

>>> nb.circuits.circuits.get(id=19)
1002840283
>>> nb.circuits.circuits.filter(id=19)
<pynetbox.core.response.RecordSet object at 0x7fa981389f00>

As a user, I prefer to keep the representation for Record as is but may change it to RecordSet. However, while giving a more thought, I don't see much value in this.

nautics889 commented 1 year ago

@abhi1693 sounds reasonable.