From 774c19e83e0ca66eff2ee8912afa19b4377deb05 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 7 Dec 2017 17:15:20 +1000 Subject: [PATCH] add the ability to disable cert verification --- anki/sync.py | 6 ++++-- aqt/sync.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/anki/sync.py b/anki/sync.py index 5e0de818c..8be45ed60 100644 --- a/anki/sync.py +++ b/anki/sync.py @@ -459,6 +459,8 @@ class LocalServer(Syncer): class AnkiRequestsClient: + verify = True + def __init__(self): self.session = requests.Session() @@ -466,13 +468,13 @@ class AnkiRequestsClient: data = _MonitoringFile(data) headers['User-Agent'] = self._agentName() return self.session.post( - url, data=data, headers=headers, stream=True, timeout=60) + url, data=data, headers=headers, stream=True, timeout=60, verify=self.verify) def get(self, url, headers=None): if headers is None: headers = {} headers['User-Agent'] = self._agentName() - return self.session.get(url, stream=True, timeout=60) + return self.session.get(url, stream=True, timeout=60, verify=self.verify) def streamContent(self, resp): resp.raise_for_status() diff --git a/aqt/sync.py b/aqt/sync.py index 2c7d1a54e..5b00d720d 100644 --- a/aqt/sync.py +++ b/aqt/sync.py @@ -188,9 +188,9 @@ AnkiWeb is too busy at the moment. Please try again in a few minutes.""") elif "code: 413" in err: return _("Your collection or a media file is too large to sync.") elif "EOF occurred in violation of protocol" in err: - return _("Error establishing a secure connection. This is usually caused by antivirus, firewall or VPN software, or problems with your ISP.") + return _("Error establishing a secure connection. This is usually caused by antivirus, firewall or VPN software, or problems with your ISP.") + " (eof)" elif "certificate verify failed" in err: - return _("Error establishing a secure connection. This is usually caused by antivirus, firewall or VPN software, or problems with your ISP.") + return _("Error establishing a secure connection. This is usually caused by antivirus, firewall or VPN software, or problems with your ISP.") + " (invalid cert)" return err def _getUserPass(self):