nopaque/app/corpora/cqi/client.py

17 lines
451 B
Python
Raw Normal View History

2020-03-23 09:10:35 +01:00
from .api import APIClient
from .models.corpora import CorpusCollection
2020-03-25 15:39:32 +01:00
class CQiClient:
2020-03-23 09:10:35 +01:00
def __init__(self, host, port=4877):
2020-03-25 15:39:32 +01:00
self.api = APIClient(host, port=port)
2020-03-23 09:10:35 +01:00
def connect(self, username='anonymous', password=''):
2020-03-29 12:38:24 +02:00
status = self.api.ctrl_connect(username, password)
2020-03-23 09:10:35 +01:00
self.corpora = CorpusCollection(self)
2020-03-29 12:38:24 +02:00
return status
2020-03-23 09:10:35 +01:00
2020-03-25 15:39:32 +01:00
def disconnect(self):
del self.corpora
2020-03-29 12:38:24 +02:00
return self.api.ctrl_bye()