I make a snmp request for the printer and get a tuple of this type

(None, 0, 0, [ObjectType(ObjectIdentity (ObjectName('1.3.6.1.2.1.25.3.5.1.2.1')), OctetString(hexValue='0a'))]) 

I can not understand what it means hexValue='0a' - by sampling, I realized that he wrote it with the printer cover open.

when the printer is good, he writes hexValue='00' . So I want to get this data. It is this '00' . How do i get them out of the tuple?

    1 answer 1

    Do you use PySNMP?

    As I understand from their docks, you need something like:

     value = tpl[3][0][1].prettyPrint() 

    Where tpl is the one you got.

    Try it, I do not have PySNMP installed now, I can not check it myself.

    • Yes that's right! thank you very much. everything works - shatoidil
    • one
      @shatoidil, please, was glad to help. It may be useful for you to read the documentation for this module. I wrote my answer, relying specifically on this page: pysnmp.sourceforge.net/examples/hlapi/asyncore/sync/manager/… - there is a piece of code at the very bottom where all the data from the tuple are printed in a loop, and I'm just looking at this cycle, I picked up the indexes just for your question. - Xander