diff options
author | Ilya Etingof <etingof@gmail.com> | 2016-03-12 10:56:45 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2016-03-12 10:56:45 +0100 |
commit | c45f60f04988f3d8810a275f7c83fb7620c3f8e3 (patch) | |
tree | 4b11d0aef3f1b087ccd1f85fa585e7db5bb8ed7b /README.md | |
parent | d524518183dd023915324f0ed2b666a61bc0d39f (diff) | |
download | pysnmp-git-c45f60f04988f3d8810a275f7c83fb7620c3f8e3.tar.gz |
pypy does not work yet
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -77,25 +77,22 @@ high-level and easy to use API is called *hlapi* and can be used like this: ```python from pysnmp.hlapi import * -iterator = getCmd( - SnmpEngine(), - CommunityData('public'), - UdpTransportTarget(('demo.snmplabs.com', 161)), - ContextData(), - ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)) -) +iterator = getCmd(SnmpEngine(), + CommunityData('public'), + UdpTransportTarget(('demo.snmplabs.com', 161)), + ContextData(), + ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0))) errorIndication, errorStatus, errorIndex, varBinds = next(iterator) if errorIndication: # SNMP engine errors - print errorIndication + print(errorIndication) else: if errorStatus: # SNMP agent errors - print(%s at %s' % (errorStatus.prettyPrint(), - errorIndex and varBinds[int(errorIndex)-1] or '?')) + print(%s at %s' % (errorStatus.prettyPrint(), varBinds[int(errorIndex)-1] if errorIndex else '?')) else: for varBind in varBinds: # SNMP response contents - print('='.join([x.prettyPrint() for x in varBind])) + print(' = '.join([x.prettyPrint() for x in varBind])) ``` We maintain publically available SNMP Agent and TRAP sink at |