From 468c63f69704a3664289456436d385d5a5abc95f Mon Sep 17 00:00:00 2001 From: Adem <34811741+aatikturk@users.noreply.github.com> Date: Fri, 23 Jun 2023 01:48:45 +0300 Subject: [PATCH] auth logger for clients added RpcVersion in auth loggers for both requests and events clients. removed the check in baseclient auth function and returned the whole response. --- obsws_python/baseclient.py | 2 +- obsws_python/events.py | 5 +++-- obsws_python/reqs.py | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/obsws_python/baseclient.py b/obsws_python/baseclient.py index fedc517..abce10f 100644 --- a/obsws_python/baseclient.py +++ b/obsws_python/baseclient.py @@ -108,7 +108,7 @@ class ObsClient: self.ws.send(json.dumps(payload)) try: response = json.loads(self.ws.recv()) - return response["op"] == 2 + return response except json.decoder.JSONDecodeError: raise OBSSDKError("failed to identify client with the server") diff --git a/obsws_python/events.py b/obsws_python/events.py index 8b6b604..d002b58 100644 --- a/obsws_python/events.py +++ b/obsws_python/events.py @@ -27,8 +27,9 @@ class EventClient: defaultkwargs = {"subs": Subs.LOW_VOLUME} kwargs = defaultkwargs | kwargs self.base_client = ObsClient(**kwargs) - if self.base_client.authenticate(): - self.logger.info(f"Successfully identified {self} with the server") + auth_status = self.base_client.authenticate() + if auth_status: + self.logger.info(f"Successfully identified {self} with the server using rpcVersion:{auth_status['d']['negotiatedRpcVersion']}") self.callback = Callback() self.subscribe() diff --git a/obsws_python/reqs.py b/obsws_python/reqs.py index 4ff4544..c363ead 100644 --- a/obsws_python/reqs.py +++ b/obsws_python/reqs.py @@ -17,8 +17,9 @@ class ReqClient: def __init__(self, **kwargs): self.logger = logger.getChild(self.__class__.__name__) self.base_client = ObsClient(**kwargs) - if self.base_client.authenticate(): - self.logger.info(f"Successfully identified {self} with the server") + auth_status = self.base_client.authenticate() + if auth_status: + self.logger.info(f"Successfully identified {self} with the server using rpcVersion:{auth_status['d']['negotiatedRpcVersion']}") def __enter__(self): return self