jenkins-bot has submitted this change and it was merged.
Change subject: Support Python 2.7.9 SSL
......................................................................
Support Python 2.7.9 SSL
Python 2.7.9 includes a backport of the SSL module from Python 3,
which caused certificate verification failures to not be detected.
Bug: T78764
Change-Id: I745db16c74eddbeeb89a663170c25e3548532ca1
---
M pywikibot/comms/http.py
1 file changed, 10 insertions(+), 7 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 7907165..ad2e2e8 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -44,7 +44,6 @@
if sys.version_info[0] > 2:
from ssl import SSLError as SSLHandshakeError
- SSL_CERT_VERIFY_FAILED_MSG = "SSL: CERTIFICATE_VERIFY_FAILED"
import queue as Queue
import urllib.parse as urlparse
from http import cookiejar as cookielib
@@ -54,11 +53,6 @@
from httplib2 import SSLHandshakeError
elif httplib2.__version__ == '0.6.0':
from httplib2 import ServerNotFoundError as SSLHandshakeError
-
- # The OpenSSL error code for
- # certificate verify failed
- # cf. `openssl errstr 14090086`
- SSL_CERT_VERIFY_FAILED_MSG = ":14090086:"
import Queue
import urlparse
@@ -73,8 +67,17 @@
from pywikibot.tools import deprecate_arg
import pywikibot.version
-_logger = "comm.http"
+if sys.version_info[:3] >= (2, 7, 9):
+ # Python 2.7.9 includes a backport of the ssl module from Python 3
+ #
https://www.python.org/dev/peps/pep-0466/
+ SSL_CERT_VERIFY_FAILED_MSG = "SSL: CERTIFICATE_VERIFY_FAILED"
+else:
+ # The OpenSSL error code for
+ # certificate verify failed
+ # cf. `openssl errstr 14090086`
+ SSL_CERT_VERIFY_FAILED_MSG = ":14090086:"
+_logger = "comm.http"
# global variables
--
To view, visit
https://gerrit.wikimedia.org/r/180482
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I745db16c74eddbeeb89a663170c25e3548532ca1
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>