From 5faf6528fb701724ac32e0a487f92281c7800bda Mon Sep 17 00:00:00 2001 From: coletdjnz Date: Tue, 17 May 2022 09:17:37 +1200 Subject: [PATCH] [http] Fix bug in retrying on read timeout in py < 3.10 socket.timeout is not an alias of TimeoutError in py < 3.10 Fixes bug in https://github.com/yt-dlp/yt-dlp/commit/a2e77303e3385da640a0904cd6cb76235fa9691b Authored-by: coletdjnz --- yt_dlp/downloader/http.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/yt_dlp/downloader/http.py b/yt_dlp/downloader/http.py index 9b7598b1c..12a2f0cc7 100644 --- a/yt_dlp/downloader/http.py +++ b/yt_dlp/downloader/http.py @@ -1,5 +1,6 @@ import os import random +import socket import ssl import time @@ -18,7 +19,13 @@ from ..utils import ( write_xattr, ) -RESPONSE_READ_EXCEPTIONS = (TimeoutError, ConnectionError, ssl.SSLError, compat_http_client.HTTPException) +RESPONSE_READ_EXCEPTIONS = ( + TimeoutError, + socket.timeout, # compat: py < 3.10 + ConnectionError, + ssl.SSLError, + compat_http_client.HTTPException +) class HttpFD(FileDownloader):