Greetings

I study to Python, there was a question with an example:

from pysnmp.entity.rfc3413.oneliner import cmdgen errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd(cmdgen.CommunityData('my-agent', 'public', 0), cmdgen.UdpTransportTarget(('10.1.1.5', 161)), (1,3,6,1,2,1,2,2,1,6,3)) print errorIndication print errorStatus print varBinds 

When I request a device name (oid 1,3,6,1,2,1,2,2,2,2,3), everything is OK: varBinds returns the name. When I request a device's poppy (oid 1,3,6,1,2,1,2,2,2,6,6), instead of poppy, varBinds returns:

None 0 [(ObjectName('1.3.6.1.2.1.2.2.1.6.1'), OctetString('\x00&Z\x8ah\x00'))]

How to convert it to poppy?

Thank you in advance!

    2 answers 2

    Something like this:

     mac = varBinds[0][1] # или где там у вас mac лежит? print(':'.join(['%02x' % ord(x) for x in mac])) 

      Check the pysnmp link