easiersnmp
easiersnmp is a wrapper around easysnmp to make it even easier to use. It also includes an alternative implementation of easysnmptable.
Python types
While I really like easysnmp, it returns instances of SNMPVariable instead of of the basic Python data types.
In addition the actual value (SNMPVariable.value) will always be a string, even if the underlying SNMP type is numeric.
SNMP GET in easysnmp
import easysnmp
session = easysnmp.Session(hostname='localhost', community='public', version=2)
result = session.get('ifIndex.1')
# result is an instance of easysnmp.SNMPVariable
print(result.oid, result.oid_index, result.snmp_type, result.value)
# ifIndex 1 INTEGER 1
# The result.value is a string even though the snmp_type is INTEGER
print(type(result.value)
# str
easiersnmp changes this behaviour by converting SNMPVariable.value into the correct data type.
SNMP GET in easiersnmp
import easiersnmp
session = easiersnmp.Session(hostname='localhost', community='public', version=2)
result = session.get('ifIndex.1')
# result is an instance of easiersnmp.SNMPVariable
print(result.oid, result.oid_index, result.snmp_type, result.value)
# ifIndex 1 INTEGER 1
# The result.value is an integer matching the snmp_type
print(type(result.value)
# int
The table below shows how values are converted.
SNMPVariable.snmp_type |
Python type |
|---|---|
INTEGER32 |
int |
INTEGER |
int |
UNSIGNED32 |
int |
GAUGE |
int |
IPADDR |
ipaddress.IPv4Address/ipaddress.IPv6Address |
OCTETSTR |
(read note below) |
TICKS |
datetime.timedelta |
OPAQUE |
|
OBJECTID |
|
NETADDR |
ipaddress.IPv4Address/ipaddress.IPv6Address |
COUNTER64 |
int |
NULL |
None |
BITS |
int |
UINTEGER |
int |
The OCTETSTR SNMP type is commonly used as a container for values that cannot be represented in any other
SNMP type. It is impossible to know the correct interpretation of an OCTETSTR without parsing the relevant
SNMP MIB.
Metadata
Release files for easiersnmp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| easiersnmp-0.2.0.tar.gz | 3.5 kB | Without provenance | Details for easiersnmp-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easiersnmp-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for easiersnmp-0.2.0-py3-none-any.whl |
Total release size: 7.5 kB
Release files / easiersnmp-0.2.0.tar.gz
| Download URL | easiersnmp-0.2.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52cd7ef8d156d70f6efd25178d62cf230ea86f7ed8c698ebf4b0072aa96c15b3
|
|
BLAKE2b-256 checksum How to use checksums |
d2913b70baf6693729e6ec07e64b56a3429cd02e242cf294ddff506450a23185
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-87-generic
|
Release files / easiersnmp-0.2.0-py3-none-any.whl
| Download URL | easiersnmp-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd4315a4fea26d1161e2f6f0b9964c5fb1c9de15cd9d52db00ffe696a8ec7988
|
|
BLAKE2b-256 checksum How to use checksums |
8644b3813485587d583ae131712578dd448da3356accfe64143ebb770aa11645
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-87-generic
|
Security for easiersnmp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.