From cf888b0c4a20cba1c1a60a317cc530f71be7a0f9 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 5 Dec 2022 16:41:34 +0000 Subject: [PATCH] conn paramters added to __repr__ magic methods add __str__ override (used in logger) --- obsws_python/events.py | 7 ++++++- obsws_python/reqs.py | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/obsws_python/events.py b/obsws_python/events.py index 0771e26..f281340 100644 --- a/obsws_python/events.py +++ b/obsws_python/events.py @@ -5,7 +5,7 @@ from threading import Thread from .baseclient import ObsClient from .callback import Callback -from .enum import Subs +from .subs import Subs """ A class to interact with obs-websocket events @@ -28,6 +28,11 @@ class EventClient: self.subscribe() def __repr__(self): + return type(self).__name__ + "({host} {port} {password} {subs})".format( + **self.base_client.__dict__ + ) + + def __str__(self): return type(self).__name__ def subscribe(self): diff --git a/obsws_python/reqs.py b/obsws_python/reqs.py index 58dc888..4771092 100644 --- a/obsws_python/reqs.py +++ b/obsws_python/reqs.py @@ -26,6 +26,11 @@ class ReqClient: self.base_client.ws.close() def __repr__(self): + return type(self).__name__ + "({host} {port} {password})".format( + **self.base_client.__dict__ + ) + + def __str__(self): return type(self).__name__ def send(self, param, data=None, raw=False):