summaryrefslogtreecommitdiff
path: root/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py')
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py
index 8e541f7b..cadc2c3c 100644
--- a/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py
@@ -17,19 +17,23 @@ usmUserTable, thus duplicate securityName parameters are possible.
"""#
from pysnmp.hlapi import *
-errorIndication, errorStatus, errorIndex, varBinds = next(
- getCmd(SnmpEngine(),
- UsmUserData('usr-md5-none', 'authkey1', securityName='myuser'),
- UdpTransportTarget(('demo.snmplabs.com', 161)),
- ContextData(),
- ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')))
+iterator = getCmd(
+ SnmpEngine(),
+ UsmUserData('usr-md5-none', 'authkey1', securityName='myuser'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ContextData(),
+ ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0'))
)
+errorIndication, errorStatus, errorIndex, varBinds = next(iterator)
+
if errorIndication:
print(errorIndication)
+
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
else:
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))