diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-01-07 01:41:54 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-01-07 01:41:56 +0200 |
commit | f68f5a40a70c3d140860edd21d7d8bcec13c5d41 (patch) | |
tree | 51a6ac377a857f67a34a0fa041acf1ab3013c42d /gsxws | |
parent | fc8a24c1efec73e0a5097411c676feed3dd4aec8 (diff) | |
download | py-gsxws-f68f5a40a70c3d140860edd21d7d8bcec13c5d41.tar.gz py-gsxws-f68f5a40a70c3d140860edd21d7d8bcec13c5d41.tar.bz2 py-gsxws-f68f5a40a70c3d140860edd21d7d8bcec13c5d41.zip |
Added workaround for SSL connections with Python 2.7.9
Diffstat (limited to 'gsxws')
-rw-r--r-- | gsxws/core.py | 11 |
1 files changed, 10 insertions, 1 deletions
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"') |