mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
add the ability to disable cert verification
This commit is contained in:
parent
39c0a57b13
commit
774c19e83e
2 changed files with 6 additions and 4 deletions
|
@ -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()
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue