summaryrefslogtreecommitdiff
path: root/wrappers/python/eduvpncommon
diff options
context:
space:
mode:
Diffstat (limited to 'wrappers/python/eduvpncommon')
-rw-r--r--wrappers/python/eduvpncommon/__init__.py2
-rw-r--r--wrappers/python/eduvpncommon/discovery.py17
-rw-r--r--wrappers/python/eduvpncommon/error.py16
3 files changed, 18 insertions, 17 deletions
diff --git a/wrappers/python/eduvpncommon/__init__.py b/wrappers/python/eduvpncommon/__init__.py
index b14b2af..52efa05 100644
--- a/wrappers/python/eduvpncommon/__init__.py
+++ b/wrappers/python/eduvpncommon/__init__.py
@@ -25,7 +25,7 @@ class GoSlice(Structure):
@staticmethod
def make(bs: bytes) -> "GoSlice":
- return GoSlice((c_char * len(bs))(*bs), len(bs), len(bs))
+ return GoSlice((c_char * len(bs))(*bs), len(bs), len(bs)) # type: ignore
class DataError(Structure):
diff --git a/wrappers/python/eduvpncommon/discovery.py b/wrappers/python/eduvpncommon/discovery.py
index 8559eb1..b30368b 100644
--- a/wrappers/python/eduvpncommon/discovery.py
+++ b/wrappers/python/eduvpncommon/discovery.py
@@ -1,4 +1,5 @@
from . import lib, GoSlice, DataError
+from .error import GoError
from ctypes import *
from typing import Callable
from enum import Enum
@@ -31,22 +32,6 @@ def GetServersList() -> str:
return getList(lib.GetServersList)
-class GoError(Exception):
- message_dict: dict
- code: Enum | None
-
- def __init__(self, err: Enum, messages: dict):
- assert err
- try:
- self.code = err
- except ValueError:
- self.code = None
- self.message_dict = messages
-
- def __str__(self):
- return self.message_dict[self.code] if self.code in self.message_dict else f"unknown error ({self.code})"
-
-
class RequestErrorCode(Enum):
ErrRequestFileError = 1 # The request for the file has failed.
ErrVerifySigError = 2 # The signature failed to verify.
diff --git a/wrappers/python/eduvpncommon/error.py b/wrappers/python/eduvpncommon/error.py
new file mode 100644
index 0000000..2ec82e7
--- /dev/null
+++ b/wrappers/python/eduvpncommon/error.py
@@ -0,0 +1,16 @@
+from enum import Enum
+
+class GoError(Exception):
+ message_dict: dict
+ code: Enum | None
+
+ def __init__(self, err: Enum, messages: dict):
+ assert err
+ try:
+ self.code = err
+ except ValueError:
+ self.code = None
+ self.message_dict = messages
+
+ def __str__(self):
+ return self.message_dict[self.code] if self.code in self.message_dict else f"unknown error ({self.code})"