Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6

前端 未结 9 1040
南方客
南方客 2020-11-27 09:06

I am writing scripts in Python2.6 with use of pyVmomi and while using one of the connection methods:

service_instance = connect.SmartConnect(host=args.ip,
           


        
9条回答
  •  温柔的废话
    2020-11-27 09:34

    I had a similar issue with PyVmomi Client. With Python Version 2.7.9, I have solved this issue with the following line of code:

    default_sslContext = ssl._create_unverified_context()
    self.client = \
                    Client(, username=, password=,
                           sslContext=default_sslContext )
    

    Note that, for this to work, you need Python 2.7.9 atleast.

提交回复
热议问题