Skip to content

Commit 60fd6cf

Browse files
committed
refactor: require websockets version 14 or newer
1 parent 7f19b23 commit 60fd6cf

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ _Changes in the next release_
1111

1212
### Added
1313
- New media-player attribute MEDIA_POSITION_UPDATED_AT ([feature-and-bug-tracker#443](https://github.com/unfoldedcircle/feature-and-bug-tracker/issues/443)).
14+
### Changed
15+
- Filter out base64 encoded media-player image fields in entity_states response log messages ([#22](https://github.com/unfoldedcircle/integration-python-library/issues/22)).
16+
- Require websockets version v14 or newer.
1417

1518
---
1619

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Workaround: use a pre-commit hook with https://github.com/scikit-image/scikit-image/blob/main/tools/generate_requirements.py
44

55
pyee>=9.0
6-
websockets>=11.0
6+
websockets>=14.0
77
zeroconf>=0.120.0

ucapi/api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import websockets
1717
from pyee.asyncio import AsyncIOEventEmitter
1818

19-
# Note: websockets ~v15 doesn't have websockets.server anymore
19+
# Note: websockets v14 doesn't have websockets.server anymore
2020
from websockets import serve
2121

2222
# workaround for pylint error: E0611: No name 'ConnectionClosedOK' in module 'websockets' (no-name-in-module) # noqa
@@ -163,6 +163,7 @@ async def _handle_ws(self, websocket) -> None:
163163
_LOG.info("WS: Connection closed")
164164

165165
except websockets.exceptions.ConnectionClosedError as e:
166+
# no idea why they made code & reason deprecated...
166167
_LOG.info("WS: Connection closed with error %d: %s", e.code, e.reason)
167168

168169
except websockets.exceptions.WebSocketException as e:
@@ -264,6 +265,7 @@ async def _broadcast_ws_event(
264265
data = {"kind": "event", "msg": msg, "msg_data": msg_data, "cat": category}
265266
data_dump = json.dumps(data)
266267
# filter fields
268+
data_log = ""
267269
if _LOG.isEnabledFor(logging.DEBUG):
268270
data_log = json.dumps(data) if filter_log_msg_data(data) else data_dump
269271

0 commit comments

Comments
 (0)