From 126e5cb0a4a85bae4c91da0c7e77e322a310c629 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Wed, 28 Jun 2023 17:56:29 +0100 Subject: [PATCH] raise OBSSDKError if auth reponse opcode != 2 --- obsws_python/baseclient.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/obsws_python/baseclient.py b/obsws_python/baseclient.py index abce10f..ca9ac1e 100644 --- a/obsws_python/baseclient.py +++ b/obsws_python/baseclient.py @@ -108,9 +108,15 @@ class ObsClient: self.ws.send(json.dumps(payload)) try: response = json.loads(self.ws.recv()) - return response + if response["op"] != 2: + raise OBSSDKError( + "failed to identify client with the server, expected response with OpCode 2 Identified" + ) + return response["d"] except json.decoder.JSONDecodeError: - raise OBSSDKError("failed to identify client with the server") + raise OBSSDKError( + "failed to identify client with the server, please check connection settings" + ) def req(self, req_type, req_data=None): payload = {