nopaque/app/corpora/cqi/client.py

17 lines
451 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-29 10:38:24 +00:00
status = self.api.ctrl_connect(username, password)
2020-03-23 08:10:35 +00:00
self.corpora = CorpusCollection(self)
2020-03-29 10:38:24 +00:00
return status
2020-03-23 08:10:35 +00:00
2020-03-25 14:39:32 +00:00
def disconnect(self):
del self.corpora
2020-03-29 10:38:24 +00:00
return self.api.ctrl_bye()