def connect_to_vc(vchost, user, pwd):
# Disabling SSL certificate verification
if hasattr(ssl, 'SSLContext'):
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.verify_mode = ssl.CERT_NONE
else:
context = None
if vchost.find(':') != -1:
host, port = vchost.split(':')
else:
host = vchost
port = 443
if context:
service_instance = SmartConnect(host=host, port=port, user=user, pwd=pwd, sslContext=context)
else:
service_instance = SmartConnect(host=host, port=port, user=user, pwd=pwd)
return service_instance.RetrieveContent()
评论列表
文章目录