summaryrefslogtreecommitdiff
path: root/examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py')
-rw-r--r--examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py b/examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py
index 0aac7eeb..4a43bc49 100644
--- a/examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py
+++ b/examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py
@@ -20,6 +20,7 @@ Functionally similar to:
import asyncio
from pysnmp.hlapi.asyncio import *
+
@asyncio.coroutine
def getone(snmpEngine, hostname):
errorIndication, errorStatus, errorIndex, varBinds = yield from getCmd(
@@ -34,19 +35,21 @@ def getone(snmpEngine, hostname):
print(errorIndication)
elif errorStatus:
print('%s at %s' % (
- errorStatus.prettyPrint(),
- errorIndex and varBinds[int(errorIndex)-1][0] or '?'
- )
+ errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'
)
+ )
else:
for varBind in varBinds:
- print(' = '.join([ x.prettyPrint() for x in varBind ]))
+ print(' = '.join([x.prettyPrint() for x in varBind]))
+
@asyncio.coroutine
def getall(snmpEngine, hostnames):
for hostname in hostnames:
yield from getone(snmpEngine, hostname)
+
snmpEngine = SnmpEngine()
loop = asyncio.get_event_loop()