From 5e7860d3edae4fffb6bdc1188da0098f984a4074 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Tue, 25 Oct 2022 05:28:50 +0100 Subject: [PATCH] override repr --- obsws_python/events.py | 5 ++++- obsws_python/reqs.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/obsws_python/events.py b/obsws_python/events.py index c4d0c8c..a2f07bc 100644 --- a/obsws_python/events.py +++ b/obsws_python/events.py @@ -43,10 +43,13 @@ class EventClient: kwargs = defaultkwargs | kwargs self.base_client = ObsClient(**kwargs) 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.subscribe() + def __repr__(self): + return type(self).__name__ + def subscribe(self): worker = Thread(target=self.trigger, daemon=True) worker.start() diff --git a/obsws_python/reqs.py b/obsws_python/reqs.py index 3c98e50..7f15a35 100644 --- a/obsws_python/reqs.py +++ b/obsws_python/reqs.py @@ -17,7 +17,7 @@ class ReqClient: def __init__(self, **kwargs): self.base_client = ObsClient(**kwargs) 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): return self @@ -25,6 +25,9 @@ class ReqClient: def __exit__(self, exc_type, exc_value, exc_traceback): self.base_client.ws.close() + def __repr__(self): + return type(self).__name__ + def send(self, param, data=None): response = self.base_client.req(param, data) if not response["requestStatus"]["result"]: