mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-09-28 05:03:43 +08:00
[rh:websockets] Add legacy connect workaround for >=17.1 (#17747)
Authored by: bashonly
This commit is contained in:
@@ -164,6 +164,11 @@ class WebsocketsRH(WebSocketRequestHandler):
|
||||
user_agent_header=None,
|
||||
ssl=ssl_ctx if wsuri.secure else None,
|
||||
close_timeout=0, # not ideal, but prevents yt-dlp hanging
|
||||
# Workaround for websockets>=17.1 support:
|
||||
# connect() is intended to be used as a context manager and other usage has been deprecated.
|
||||
# The `legacy` flag was added in 17.1 for backwards compat and has not yet been deprecated.
|
||||
# Ref: https://github.com/python-websockets/websockets/commit/1f7f0e537233ac82e4ca51921678963c696c8c08
|
||||
**({'legacy': True} if websockets_version >= (17, 1) else {}),
|
||||
)
|
||||
return WebsocketsResponseAdapter(conn, url=request.url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user