named to SmartConnectNoSSL and extended to cover Connect as well

This commit is contained in:
Lance Hasson 2016-06-14 15:50:12 -07:00
parent f91ccde071
commit 82fba028bf
1 changed files with 31 additions and 1 deletions

View File

@ -271,6 +271,36 @@ def Connect(host='localhost', port=443, user='root', pwd='',
return si
def ConnectNoSSL(host='localhost', port=443, user='root', pwd='',
service="hostd", adapter="SOAP", namespace=None, path="/sdk",
version=None, keyFile=None, certFile=None, thumbprint=None,
sslContext=None, b64token=None, mechanism='userpass'):
"""
Provides a standard method for connecting to a specified server without SSL
verification. Useful when connecting to servers with self-signed certificates
or when you wish to ignore SSL altogether. Will attempt to create an unverified
SSL context and then connect via the Connect method.
"""
if hasattr(ssl, '_create_unverified_context'):
sslContext = ssl._create_unverified_context()
else:
sslContext = None
return Connect(host=host,
port=portNumber,
user=user,
pwd=pwd,
service=service,
adapter='SOAP',
version=supportedVersion,
path=path,
keyFile=keyFile,
certFile=certFile,
thumbprint=thumbprint,
sslContext=sslContext,
b64token=b64token,
mechanism=mechanism)
def Disconnect(si):
"""
@ -804,7 +834,7 @@ def SmartConnect(protocol='https', host='localhost', port=443, user='root', pwd=
b64token=b64token,
mechanism=mechanism)
def ConnectNoSSL(protocol='https', host='localhost', port=443, user='root', pwd='',
def SmartConnectNoSSL(protocol='https', host='localhost', port=443, user='root', pwd='',
service="hostd", path="/sdk",
preferredApiVersions=None, keyFile=None, certFile=None,
thumbprint=None, sslContext=None, b64token=None, mechanism='userpass'):