summaryrefslogtreecommitdiff
path: root/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py')
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py
index d883d16a..b69f1c6b 100644
--- a/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py
@@ -25,20 +25,25 @@ from pysnmp.hlapi import *
queue = [[ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1))],
[ObjectType(ObjectIdentity('IF-MIB', 'ifOutOctets', 1))]]
-iterator = getCmd(SnmpEngine(),
- UsmUserData('usr-md5-none', 'authkey1'),
- UdpTransportTarget(('demo.snmplabs.com', 161)),
- ContextData())
+iterator = getCmd(
+ SnmpEngine(),
+ UsmUserData('usr-md5-none', 'authkey1'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ContextData()
+)
next(iterator)
while queue:
errorIndication, errorStatus, errorIndex, varBinds = iterator.send(queue.pop())
+
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]))