diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/__init__.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/client/__init__.py b/client/__init__.py new file mode 100644 index 0000000..8781a96 --- /dev/null +++ b/client/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 + +import multiprocessing.managers + +__all__ = ['get_session_by_id', 'get_or_create_session'] + +class CodeqManager(multiprocessing.managers.BaseManager): + pass + +CodeqManager.register('PrologSession') +CodeqManager.register('UserSession') +CodeqManager.register('get_session_by_id') +CodeqManager.register('get_or_create_session') +CodeqManager.register('authenticate_and_create_session') + +m = CodeqManager(address=('localhost', 16231), authkey=b'c0d3q3y') +m.connect() + +def get_session_by_id(sid): + return m.get_session_by_id(sid) + +def get_or_create_session(uid, username, sid=None): + return m.get_or_create_session(uid, username, sid) + +def authenticate_and_create_session(username, password): + return m.authenticate_and_create_session(username, password) |