Skip to content

get("1.3.6.1.2.1.2.1.0") good; get(OID("1.3.6.1.2.1.2.1.0")) throws exception #110

@mmaney

Description

@mmaney

It seems that despite many of the examples showing it this way, get() (at least) does NOT accept an ObjectIdentifier object - it wants that string and nothing else, raising

AttributeError: 'ObjectIdentifier' object has no attribute 'startswith'

just as OID(OID("1.3.6.1.2.1.2.1.0")) does.

Although most (?) of the puresnmp code appears to pass the oid value around without worrying much about what it is, it all goes wrong when "oid" is an ObjectIdentifier rather than a string like so:

File "/home/snmpmon/rrd/pst2.py", line 8, in example
output = await client.get(oid)
File "/home/snmpmon/.local/lib/python3.9/site-packages/puresnmp/api/pythonic.py", line 68, in get
oid_internal = ObjectIdentifier(oid)
File "/home/snmpmon/.local/lib/python3.9/site-packages/x690/types.py", line 738, in init
and value.startswith(".")

It would seem that mypy OUGHT to be raising heck about passing an ObjectIdentifier into x690's ObjectIdentifier() - does it just not understand the X690Type[str] annotation, perhaps?

Freshly pip installed, x690.version = '1.0.0.post1', puresnmp.version = '2.0.0.post1' on Debian Bullseye with Py3.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions