raise OBSSDKError if auth reponse opcode != 2

This commit is contained in:
onyx-and-iris 2023-06-28 17:56:29 +01:00
parent 4ced7193df
commit 126e5cb0a4

View File

@ -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 = {