puresnmp.credentials module

This module contains helper-classes for the different credentials used in SNMP.

These credentials also define the underlying message-processing model by their very nature. V1 credentials will use the V1 message processing model, V2C uses the community-based V2 message-processing model and so on.

class puresnmp.credentials.Auth(key: bytes, method: str)

Bases: NamedTuple

Configuration for “authentication” values in SNMPv3

key: bytes

The authentication key (password)

method: str

The authentication method (md5, sha, …)

class puresnmp.credentials.Credentials(mpm: int)

Bases: object

Parent class for SNMP credentials. This should not be used other than type-hinting. Use the concrete classes for SNMP calls.

mpm: int

The message-processing model identifier

class puresnmp.credentials.Priv(key: bytes, method: str)

Bases: NamedTuple

Configuration for “privacy/encryption” values in SNMPv3

key: bytes

The privacy key (password)

method: str

The privacy method (des, aes, …)

class puresnmp.credentials.V1(community: str)

Bases: Credentials

Credentials for SNMPv1 exchanges

community: str

The community-string

class puresnmp.credentials.V2C(community: str)

Bases: V1

Credentials for community-based SNMPv2 exchanges

community: str

The community-string

class puresnmp.credentials.V3(username: str, auth: Auth | None = None, priv: Priv | None = None)

Bases: Credentials

Credentials for SNMPv3 exchanges

auth: Auth | None

Authentication details. If left at “None”, authentication is disabled.

priv: Priv | None

Encryption details. If left at “None”, encryption is disabled. Note that for encryption to be enabled, authentication must also be enabled.

username: str

The local username for SNMP exchanges