[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)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user