From bbbafc1c2452b53b239b011888bf0e55ff259ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 9 Dec 2019 20:14:25 +0100 Subject: [PATCH] [downloader:http] catch both possible SSLException instances With pyOpenSSL installed, but disabled, the SSLError exception would be set to the one from pyOpenSSL, which could never get raised. This commit solves this problem by catching both, the native SSLError exception as well as the one from pyOpenSSL (if available.1) --- CHANGELOG.md | 4 +++- gallery_dl/downloader/http.py | 7 ++++--- gallery_dl/version.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e3c68fa..6da85e45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## Unreleased + ## 1.12.0 - 2019-12-08 ### Additions - [flickr] support 3k, 4k, 5k, and 6k photo sizes ([#472](https://github.com/mikf/gallery-dl/issues/472)) @@ -12,7 +14,7 @@ - [deviantart] ensure consistent username capitalization ([#455](https://github.com/mikf/gallery-dl/issues/455)) - [directlink] split `{path}` into `{path}/{filename}.{extension}` - [twitter] update metadata fields with user/author information -- [postprocessor:metadata] filter private entries & rename 'format' to 'content-format' +- [postprocessor:metadata] filter private entries & rename `format` to `content-format` - Enable `cookies-update` by default ### Fixes - [2chan] fix metadata extraction diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 03f92b29..2f43430b 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -15,10 +15,11 @@ from requests.exceptions import RequestException, ConnectionError, Timeout from .common import DownloaderBase from .. import text +from ssl import SSLError try: - from OpenSSL.SSL import Error as SSLError + from OpenSSL.SSL import Error as OpenSSLError except ImportError: - from ssl import SSLError + OpenSSLError = SSLError class HttpDownloader(DownloaderBase): @@ -143,7 +144,7 @@ class HttpDownloader(DownloaderBase): # download content try: self.receive(response, file) - except (RequestException, SSLError) as exc: + except (RequestException, SSLError, OpenSSLError) as exc: msg = str(exc) print() continue diff --git a/gallery_dl/version.py b/gallery_dl/version.py index 8b1973eb..b156a576 100644 --- a/gallery_dl/version.py +++ b/gallery_dl/version.py @@ -6,4 +6,4 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -__version__ = "1.12.0" +__version__ = "1.12.1-dev"