summaryrefslogtreecommitdiff
path: root/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py')
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py
index 94f591c4..36cfc050 100644
--- a/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py
@@ -65,19 +65,23 @@ print('Remote securityEngineId = %s' % securityEngineId.prettyPrint())
authData = UsmUserData('usr-md5-none', 'authkey1',
securityEngineId=securityEngineId)
-errorIndication, errorStatus, errorIndex, varBinds = next(
- getCmd(snmpEngine,
- authData,
- transportTarget,
- ContextData(),
- ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')))
+iterator = getCmd(
+ snmpEngine,
+ authData,
+ transportTarget,
+ 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 name, val in varBinds:
print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))