override repr

This commit is contained in:
onyx-and-iris 2022-10-25 05:28:50 +01:00
parent c3ebc5e777
commit 5e7860d3ed
2 changed files with 8 additions and 2 deletions

View File

@ -43,10 +43,13 @@ class EventClient:
kwargs = defaultkwargs | kwargs kwargs = defaultkwargs | kwargs
self.base_client = ObsClient(**kwargs) self.base_client = ObsClient(**kwargs)
if self.base_client.authenticate(): if self.base_client.authenticate():
self.logger.info("Successfully identified client with the server") self.logger.info(f"Successfully identified {self} with the server")
self.callback = Callback() self.callback = Callback()
self.subscribe() self.subscribe()
def __repr__(self):
return type(self).__name__
def subscribe(self): def subscribe(self):
worker = Thread(target=self.trigger, daemon=True) worker = Thread(target=self.trigger, daemon=True)
worker.start() worker.start()

View File

@ -17,7 +17,7 @@ class ReqClient:
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.base_client = ObsClient(**kwargs) self.base_client = ObsClient(**kwargs)
if self.base_client.authenticate(): if self.base_client.authenticate():
self.logger.info("Successfully identified client with the server") self.logger.info(f"Successfully identified {self} with the server")
def __enter__(self): def __enter__(self):
return self return self
@ -25,6 +25,9 @@ class ReqClient:
def __exit__(self, exc_type, exc_value, exc_traceback): def __exit__(self, exc_type, exc_value, exc_traceback):
self.base_client.ws.close() self.base_client.ws.close()
def __repr__(self):
return type(self).__name__
def send(self, param, data=None): def send(self, param, data=None):
response = self.base_client.req(param, data) response = self.base_client.req(param, data)
if not response["requestStatus"]["result"]: if not response["requestStatus"]["result"]: