aboutsummaryrefslogtreecommitdiff
path: root/python/olm/_base.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-23 18:03:32 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-23 18:03:32 +0100
commitea130cae0db3d68a49ae2059b2568eb8504e84b6 (patch)
treecda9cb4f02373c2babcadb65b99564d7599512ba /python/olm/_base.py
parentaacf1154684885d244182eb9cd68e429d72ee57a (diff)
parent7ccaae564aa0d62aecd50e0cd05cc11af58b2d25 (diff)
Merge branch 'rav/refactor_python_wrappers'
Diffstat (limited to 'python/olm/_base.py')
-rw-r--r--python/olm/_base.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/olm/_base.py b/python/olm/_base.py
new file mode 100644
index 0000000..8238957
--- /dev/null
+++ b/python/olm/_base.py
@@ -0,0 +1,19 @@
+import os.path
+
+from ctypes import *
+
+def read_random(n):
+ with open("/dev/urandom", "rb") as f:
+ return f.read(n)
+
+lib = cdll.LoadLibrary(os.path.join(
+ os.path.dirname(__file__), "..", "..", "build", "libolm.so")
+)
+
+lib.olm_error.argtypes = []
+lib.olm_error.restypes = c_size_t
+
+ERR = lib.olm_error()
+
+class OlmError(Exception):
+ pass