summaryrefslogtreecommitdiff
path: root/examples/hlapi/trollius/agent/ntforg/default-v1-trap.py
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2016-03-30 23:56:16 +0200
committerIlya Etingof <etingof@gmail.com>2016-03-30 23:56:16 +0200
commite4c4e376316835e9eff0ac4df15ec29db7a7808b (patch)
tree201df381a315fad81cdb280e5feeb63c2cd3b76d /examples/hlapi/trollius/agent/ntforg/default-v1-trap.py
parent929eb1b5339e13b77d1f75fca1efc79adb316223 (diff)
downloadpysnmp-git-e4c4e376316835e9eff0ac4df15ec29db7a7808b.tar.gz
pep8 fixes
Diffstat (limited to 'examples/hlapi/trollius/agent/ntforg/default-v1-trap.py')
-rw-r--r--examples/hlapi/trollius/agent/ntforg/default-v1-trap.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/hlapi/trollius/agent/ntforg/default-v1-trap.py b/examples/hlapi/trollius/agent/ntforg/default-v1-trap.py
index 6394dbd3..514cff2f 100644
--- a/examples/hlapi/trollius/agent/ntforg/default-v1-trap.py
+++ b/examples/hlapi/trollius/agent/ntforg/default-v1-trap.py
@@ -24,14 +24,17 @@ Functionally similar to:
import trollius
from pysnmp.hlapi.asyncio import *
+
@trollius.coroutine
def run():
snmpEngine = SnmpEngine()
- errorIndication, errorStatus, \
- errorIndex, varBinds = yield trollius.From(
+ (errorIndication,
+ errorStatus,
+ errorIndex,
+ varBinds) = yield trollius.From(
sendNotification(
snmpEngine,
- CommunityData('public'), # mpModel=0),
+ CommunityData('public'), # mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 162)),
ContextData(),
'inform',
@@ -47,11 +50,13 @@ def run():
if errorIndication:
print(errorIndication)
elif errorStatus:
- print('%s: at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex)-1][0] or '?'))
+ 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]))
snmpEngine.transportDispatcher.closeDispatcher()
+
trollius.get_event_loop().run_until_complete(run())