Skip to content

Commit

Permalink
[downloader:http] remove 'pyopenssl' import (#5156)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Feb 4, 2024
1 parent 62d6f5f commit 0dacb2b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions gallery_dl/downloader/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
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):
Expand Down Expand Up @@ -249,7 +244,7 @@ def _download_impl(self, url, pathfmt):
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
Expand Down Expand Up @@ -283,7 +278,7 @@ def _download_impl(self, url, pathfmt):
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
Expand All @@ -310,7 +305,7 @@ def release_conn(self, response):
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); "
Expand Down

0 comments on commit 0dacb2b

Please sign in to comment.