summaryrefslogtreecommitdiff
path: root/pysnmp/proto/api
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2019-02-10 16:38:35 +0100
committerGitHub <noreply@github.com>2019-02-10 16:38:35 +0100
commit588b9b902d191d8010cb6b247fcb07887d59542c (patch)
tree419b01d2598e91331db784ac3a6675324aba8c24 /pysnmp/proto/api
parent9664858b145140a4fbb2a22b633c1ab41c2555bd (diff)
downloadpysnmp-git-588b9b902d191d8010cb6b247fcb07887d59542c.tar.gz
Uppercase global constants (#238)
This is a massive patch essentially upper-casing global/class attributes that mean to be constants. Some previously exposed constants have been preserved for compatibility reasons (notably, in `hlapi`), though the rest might break user code relying on pysnmp 4.
Diffstat (limited to 'pysnmp/proto/api')
-rw-r--r--pysnmp/proto/api/__init__.py6
-rw-r--r--pysnmp/proto/api/verdec.py5
2 files changed, 6 insertions, 5 deletions
diff --git a/pysnmp/proto/api/__init__.py b/pysnmp/proto/api/__init__.py
index d742ecc7..fd404e5c 100644
--- a/pysnmp/proto/api/__init__.py
+++ b/pysnmp/proto/api/__init__.py
@@ -7,8 +7,8 @@
from pysnmp.proto.api import v1, v2c, verdec
# Protocol versions
-protoVersion1 = 0
-protoVersion2c = 1
-protoModules = {protoVersion1: v1, protoVersion2c: v2c}
+SNMP_VERSION_1 = 0
+SNMP_VERSION_2C = 1
+PROTOCOL_MODULES = {SNMP_VERSION_1: v1, SNMP_VERSION_2C: v2c}
decodeMessageVersion = verdec.decodeMessageVersion
diff --git a/pysnmp/proto/api/verdec.py b/pysnmp/proto/api/verdec.py
index 7076e63c..9bbb73bd 100644
--- a/pysnmp/proto/api/verdec.py
+++ b/pysnmp/proto/api/verdec.py
@@ -23,5 +23,6 @@ def decodeMessageVersion(wholeMsg):
if eoo.endOfOctets.isSameTypeWith(ver):
raise ProtocolError('EOO at SNMP version component')
return ver
- except PyAsn1Error:
- raise ProtocolError('Invalid BER at SNMP version component')
+
+ except PyAsn1Error as exc:
+ raise ProtocolError('Invalid BER at SNMP version component: %s' % exc)