From f68f5a40a70c3d140860edd21d7d8bcec13c5d41 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 7 Jan 2015 01:41:54 +0200 Subject: Added workaround for SSL connections with Python 2.7.9 --- gsxws/core.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gsxws/core.py b/gsxws/core.py index c2e26a4..b19cfeb 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -274,7 +274,16 @@ class GsxRequest(object): logging.debug(self._url) logging.debug(xmldata) - ws = httplib.HTTPSConnection(parsed.netloc, timeout=GSX_TIMEOUT) + try: + # Python 2.6.9 and newer + # @TODO: Implement proper verified context + from ssl import _create_unverified_context + ws = httplib.HTTPSConnection(parsed.netloc, + timeout=GSX_TIMEOUT, + context=_create_unverified_context()) + except ImportError: + ws = httplib.HTTPSConnection(parsed.netloc, timeout=GSX_TIMEOUT) + ws.putrequest("POST", parsed.path) ws.putheader("User-Agent", "py-gsxws %s" % VERSION) ws.putheader("Content-type", 'text/xml; charset="UTF-8"') -- cgit v1.2.3