From 897e1eabfd8ede89f13443319e567988e0e7a562 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 7 Jul 2017 08:51:09 +0530 Subject: [PATCH] Ignore SSL errors when contacting isbndb as they seem to have no intention of fixing their broken SSL certificate --- src/calibre/ebooks/metadata/sources/base.py | 8 ++++++-- src/calibre/ebooks/metadata/sources/isbndb.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/base.py b/src/calibre/ebooks/metadata/sources/base.py index 015a9fea60..e6bc3b58a1 100644 --- a/src/calibre/ebooks/metadata/sources/base.py +++ b/src/calibre/ebooks/metadata/sources/base.py @@ -23,6 +23,7 @@ def create_log(ostream=None): log.outputs = [FileStream(ostream)] return log + # Comparing Metadata objects for relevance {{{ words = ("the", "a", "an", "of", "and") prefix_pat = re.compile(r'^(%s)\s+'%("|".join(words))) @@ -216,6 +217,10 @@ class Source(Plugin): #: correctly first supports_gzip_transfer_encoding = False + #: Set this to True to ignore HTTPS certificate errors when connecting + #: to this source. + ignore_ssl_errors = False + #: Cached cover URLs can sometimes be unreliable (i.e. the download could #: fail or the returned image could be bogus. If that is often the case #: with this source set to False @@ -293,7 +298,7 @@ class Source(Plugin): @property def browser(self): if self._browser is None: - self._browser = browser(user_agent=self.user_agent) + self._browser = browser(user_agent=self.user_agent, verify_ssl_certificates=not self.ignore_ssl_errors) if self.supports_gzip_transfer_encoding: self._browser.set_handle_gzip(True) return self._browser.clone_browser() @@ -596,4 +601,3 @@ class Source(Plugin): pass # }}} - diff --git a/src/calibre/ebooks/metadata/sources/isbndb.py b/src/calibre/ebooks/metadata/sources/isbndb.py index d39f04774a..a4d0946f8c 100644 --- a/src/calibre/ebooks/metadata/sources/isbndb.py +++ b/src/calibre/ebooks/metadata/sources/isbndb.py @@ -29,6 +29,7 @@ class ISBNDB(Source): supports_gzip_transfer_encoding = True # Shortcut, since we have no cached cover URLS cached_cover_url_is_reliable = False + ignore_ssl_errors = True options = ( Option('isbndb_key', 'string', None, _('IsbnDB key:'),