I'm running python 3.13. I have v 7.1.17 of the pysnmp module installed.
I'm trying to do a simple SNMP get, but I am having trouble understanding how pysnmp works. The examples I find online are out of date, don't work, or are confusing for me.
This is my code:
TypeError: 'coroutine' object is not an iterator
Can someone explain why this is, or better yet, provide a very simple SNMP get example using pysnmp?
I'm trying to do a simple SNMP get, but I am having trouble understanding how pysnmp works. The examples I find online are out of date, don't work, or are confusing for me.
This is my code:
from pysnmp.hlapi.v3arch import *
community_string = 'mystring'
host = 'my_host'
x = get_cmd(SnmpEngine(),
CommunityData(community_string),
UdpTransportTarget.create((host, 161)),
ContextData(),
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.5.0')), # SysName
lookupMib=False,
lexicographicMode=False,
)
print(next(x))When run, I get the following error when I try to print(next(x)):TypeError: 'coroutine' object is not an iterator
Can someone explain why this is, or better yet, provide a very simple SNMP get example using pysnmp?
