diff options
Diffstat (limited to 'examples/hlapi/twisted/manager/cmdgen/custom-timeout-and-retries.py')
-rw-r--r-- | examples/hlapi/twisted/manager/cmdgen/custom-timeout-and-retries.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/hlapi/twisted/manager/cmdgen/custom-timeout-and-retries.py b/examples/hlapi/twisted/manager/cmdgen/custom-timeout-and-retries.py index 19dfadda..f0419fa7 100644 --- a/examples/hlapi/twisted/manager/cmdgen/custom-timeout-and-retries.py +++ b/examples/hlapi/twisted/manager/cmdgen/custom-timeout-and-retries.py @@ -18,17 +18,16 @@ Functionally similar to: from twisted.internet.task import react from pysnmp.hlapi.twisted import * + def success((errorStatus, errorIndex, varBinds), hostname): if errorStatus: - print('%s: %s at %s' % ( - hostname, - errorStatus.prettyPrint(), - errorIndex and varBinds[int(errorIndex)-1][0] or '?' - ) - ) + print('%s: %s at %s' % (hostname, + 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])) + def failure(errorIndication, hostname): print('%s failure: %s' % (hostname, errorIndication)) @@ -48,4 +47,5 @@ def getSysDescr(reactor, hostname): return d + react(getSysDescr, ['demo.snmplabs.com']) |