1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2025-01-31 19:51:34 +01:00

[downloader:http] remove 'pyopenssl' import (#5156)

This commit is contained in:
Mike Fährmann 2024-02-04 21:06:54 +01:00
parent 62d6f5f8d2
commit 0dacb2b24c
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -13,12 +13,7 @@ import mimetypes
from requests.exceptions import RequestException, ConnectionError, Timeout
from .common import DownloaderBase
from .. import text, util
from ssl import SSLError
try:
from OpenSSL.SSL import Error as OpenSSLError
except ImportError:
OpenSSLError = SSLError
class HttpDownloader(DownloaderBase):
@ -249,7 +244,7 @@ class HttpDownloader(DownloaderBase):
file_header = next(
content if response.raw.chunked
else response.iter_content(16), b"")
except (RequestException, SSLError, OpenSSLError) as exc:
except (RequestException, SSLError) as exc:
msg = str(exc)
print()
continue
@ -283,7 +278,7 @@ class HttpDownloader(DownloaderBase):
self.out.start(pathfmt.path)
try:
self.receive(fp, content, size, offset)
except (RequestException, SSLError, OpenSSLError) as exc:
except (RequestException, SSLError) as exc:
msg = str(exc)
print()
continue
@ -310,7 +305,7 @@ class HttpDownloader(DownloaderBase):
try:
for _ in response.iter_content(self.chunk_size):
pass
except (RequestException, SSLError, OpenSSLError) as exc:
except (RequestException, SSLError) as exc:
print()
self.log.debug(
"Unable to consume response body (%s: %s); "