libutils.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:pynsxv 作者: vmware 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号