From 19afc3ba9357f30977534cf0657616d8523701a1 Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 28 Jan 2024 15:03:05 +0100 Subject: [PATCH] Correct generating cast messages --- pychromecast/socket_client.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pychromecast/socket_client.py b/pychromecast/socket_client.py index 7d742bc9b..642a71254 100644 --- a/pychromecast/socket_client.py +++ b/pychromecast/socket_client.py @@ -105,11 +105,6 @@ def _message_to_string(message, data=None): ) -def _json_to_payload(data: dict) -> bytes: - """Encodes a python value into JSON format.""" - return json.dumps(data, ensure_ascii=False).encode("utf8") - - @dataclass(frozen=True) class NetworkAddress: """Network address container.""" @@ -877,7 +872,7 @@ def send_message( cast_channel_pb2.CastMessage.STRING # pylint: disable=no-member ) msg.namespace = namespace - msg.payload_utf8 = _json_to_payload(data) + msg.payload_utf8 = json.dumps(data, ensure_ascii=False) # prepend message with Big-Endian 4 byte payload size be_size = pack(">I", msg.ByteSize())