[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:
@@ -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