puresnmp v2.x is a major update from puresnmp v1.x. See Upgrading from v1.x to v2.x for information of the key changes.

The v1.x branch is now in “maintenance only” mode and will only receive critical fixes.

Basic Example

This basic example executes an SNMP GET request. The details are explained below.

import asyncio
from puresnmp import Client, V2C, PyWrapper

async def example():
   client = PyWrapper(Client("", V2C("public")))
   output = await client.get("")
   return output


The above will execute a community-based SNMPv2 GET request on the device with IP and read the value on OID The output will be for example:

b'Linux 2e9eccbc4529 4.15.0-115-generic #116-Ubuntu SMP Wed Aug 26 14:04:49 UTC 2020 x86_64'

More Requests

Want to do more than just a “GET” request? Have a look at PyWrapper.


Client("", V2C("public"))

This creates a new “leaky” client to the device at IP “”. Is is “leaky” because method arguments and return-values use SNMP-specific like puresnmp.types.Counter or x690.types.OctetString.

It is already usable as-is but can be improved by wrapping it with PyWrapper.

client = PyWrapper(...)

This wrapper exposes the same methods as the internal client but converts input- and output-values from/to native (pure) Python types. This abstracts SNMP internals and makes client code much more pythonic. It also decouples client-code from internal changes and should make client code more robust and independent.



When executing “SNMP SET” requests, the SNMP specific data-types need to be known. So “SET” commands will inherently always be leaky.

Indices and tables