Forked from quasarj/python_2.7.9_suds_unverified.patch
Created
February 28, 2018 18:50
-
-
Save alexlopes/d8962c7e577958de7f3da45ba8ac22b4 to your computer and use it in GitHub Desktop.
Patch to allow SUDS to work with invalid (or self-signed) SSL certs, on python 2.7.9+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /usr/lib/python2.7/site-packages/suds/transport/http.py 2015-06-09 17:40:15.000000000 -0500 | |
+++ http.py 2015-06-09 17:42:05.953929465 -0500 | |
@@ -19,6 +19,7 @@ | |
""" | |
import urllib2 as u2 | |
+import ssl | |
import base64 | |
import socket | |
from suds.transport import * | |
@@ -135,6 +136,14 @@ | |
@rtype: [Handler,...] | |
""" | |
handlers = [] | |
+ | |
+ # build a special unverified HTTPSHandler | |
+ unverified_context = ssl.create_default_context() | |
+ unverified_context.check_hostname = False | |
+ unverified_context.verify_mode = ssl.CERT_NONE | |
+ unverified_handler = u2.HTTPSHandler(context=unverified_context) | |
+ | |
+ handlers.append(unverified_handler) | |
handlers.append(u2.ProxyHandler(self.proxy)) | |
return handlers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment