Giter VIP home page Giter VIP logo

Comments (3)

BYT3M3 avatar BYT3M3 commented on May 22, 2024

I'd like to help fix this issue, because I have a certain OID I cannot set properly without the Hex-String functionality.

from easysnmp.

burakCokyildirim avatar burakCokyildirim commented on May 22, 2024

Hello,
Is there any developments about this problem? or Any solution?

from easysnmp.

benafischer94 avatar benafischer94 commented on May 22, 2024

For anyone else that comes across this, while I agree the compat could use some help on OCTET STR types. A short work around that appears to be good and concise:

from easysnmp import snmp_get

OID = iso.0.8802.1.1.2.1.4.1.1.7.2520.9.1
snmp_get(OID, hostname='192.0.2.1', community='public', version=2).value.encode('latin-1')

You'll end up with a bytes object of the hex.

E.g. follow the original example if snmpget returns:
iso.0.8802.1.1.2.1.4.1.1.7.2520.9.1 = Hex-STRING: 31 2F 33 00

Then you would get:

from easysnmp import snmp_get

OID = iso.0.8802.1.1.2.1.4.1.1.7.2520.9.1
snmp_get(OID, hostname='192.0.2.1', community='public', version=2).value.encode('latin-1')

b'\x31\x2f\x33\x00'

I'm sure there was some design reason behind using latin-1 encoding originally. But it does draw a good amount of confusion, especially with beginners. And the fragmentation of SNMP in Python doesn't help much.

from easysnmp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.