nopaque/app/corpora/cqi/client.py

16 lines
413 B
Python
Raw Normal View History

2020-03-23 08:10:35 +00:00
from .api import APIClient
from .models.corpora import CorpusCollection
2020-03-25 14:39:32 +00:00
class CQiClient:
2020-03-23 08:10:35 +00:00
def __init__(self, host, port=4877):
2020-03-25 14:39:32 +00:00
self.api = APIClient(host, port=port)
2020-03-23 08:10:35 +00:00
def connect(self, username='anonymous', password=''):
2020-03-25 14:39:32 +00:00
self.api.ctrl_connect(username, password)
2020-03-23 08:10:35 +00:00
self.corpora = CorpusCollection(self)
2020-03-25 14:39:32 +00:00
def disconnect(self):
del self.corpora
self.api.ctrl_bye()