mirror of
https://github.com/onyx-and-iris/obsws-python.git
synced 2024-11-21 20:30:54 +00:00
log and rethrow TimeoutError on connection
we can just encode challenge here. shorten opcode != 2 message
This commit is contained in:
parent
ca72b92eb3
commit
5db7a705c5
@ -43,7 +43,7 @@ class ObsClient:
|
|||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.logger.error(f"{type(e).__name__}: {e}")
|
self.logger.error(f"{type(e).__name__}: {e}")
|
||||||
raise
|
raise
|
||||||
except (ConnectionRefusedError, WebSocketTimeoutException) as e:
|
except (ConnectionRefusedError, TimeoutError, WebSocketTimeoutException) as e:
|
||||||
self.logger.exception(f"{type(e).__name__}: {e}")
|
self.logger.exception(f"{type(e).__name__}: {e}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -97,9 +97,9 @@ class ObsClient:
|
|||||||
auth = base64.b64encode(
|
auth = base64.b64encode(
|
||||||
hashlib.sha256(
|
hashlib.sha256(
|
||||||
(
|
(
|
||||||
secret.decode()
|
secret
|
||||||
+ self.server_hello["d"]["authentication"]["challenge"]
|
+ self.server_hello["d"]["authentication"]["challenge"].encode()
|
||||||
).encode()
|
)
|
||||||
).digest()
|
).digest()
|
||||||
).decode()
|
).decode()
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ class ObsClient:
|
|||||||
response = json.loads(self.ws.recv())
|
response = json.loads(self.ws.recv())
|
||||||
if response["op"] != 2:
|
if response["op"] != 2:
|
||||||
raise OBSSDKError(
|
raise OBSSDKError(
|
||||||
"failed to identify client with the server, expected response with OpCode 2 Identified"
|
"failed to identify client with the server, expected response with OpCode 2"
|
||||||
)
|
)
|
||||||
return response["d"]
|
return response["d"]
|
||||||
except json.decoder.JSONDecodeError:
|
except json.decoder.JSONDecodeError:
|
||||||
|
Loading…
Reference in New Issue
Block a user