diff options
author | Lesmiscore (Naoya Ozaki) <nao20010128@gmail.com> | 2022-02-13 14:58:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-13 14:58:21 +0900 |
commit | da42679b87005a7a3e08496dc9f5959234e2a8a8 (patch) | |
tree | 1b58a2d6e2c3bbe46ff45aa1ed5c8c24bd3e7432 /yt_dlp/compat.py | |
parent | 29448350808619262d6a9ddd393a2c28df1720fe (diff) | |
download | hypervideo-pre-da42679b87005a7a3e08496dc9f5959234e2a8a8.tar.lz hypervideo-pre-da42679b87005a7a3e08496dc9f5959234e2a8a8.tar.xz hypervideo-pre-da42679b87005a7a3e08496dc9f5959234e2a8a8.zip |
[utils] WebSockets wrapper for non-async functions (#2417)
Authored by: Lesmiscore
Diffstat (limited to 'yt_dlp/compat.py')
-rw-r--r-- | yt_dlp/compat.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/yt_dlp/compat.py b/yt_dlp/compat.py index b97d4512e..2bc6a6b7f 100644 --- a/yt_dlp/compat.py +++ b/yt_dlp/compat.py @@ -134,6 +134,16 @@ except AttributeError: asyncio.run = compat_asyncio_run +try: # >= 3.7 + asyncio.tasks.all_tasks +except AttributeError: + asyncio.tasks.all_tasks = asyncio.tasks.Task.all_tasks + +try: + import websockets as compat_websockets +except ImportError: + compat_websockets = None + # Python 3.8+ does not honor %HOME% on windows, but this breaks compatibility with youtube-dl # See https://github.com/yt-dlp/yt-dlp/issues/792 # https://docs.python.org/3/library/os.path.html#os.path.expanduser @@ -303,6 +313,7 @@ __all__ = [ 'compat_urllib_response', 'compat_urlparse', 'compat_urlretrieve', + 'compat_websockets', 'compat_xml_parse_error', 'compat_xpath', 'compat_zip', |