pyVmomi made a switch to using requests a while back where it used urllib2 in the past. One of the side effects of doing that was that when you connect to a vCenter or ESX/i HostSystem that has a self signed ssl cert (which is the default) you get a warning like:
>>> from pyVim.connect import SmartConnect >>> si = SmartConnect(host='172.16.214.129', firstname.lastname@example.org', pwd='password') /Users/errr/venvs/pyVmomi/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py:730: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html (This warning will only appear once by default.) InsecureRequestWarning)
How can you disable that message though? Well thats pretty simple. Let me show you how to do it. Since as I mentioned above pyVmomi now uses requests we can disable this at the top of our script like so:
>>> from pyVim.connect import SmartConnect >>> import requests >>> requests.packages.urllib3.disable_warnings() >>> si = SmartConnect(host='172.16.214.129', email@example.com', pwd='password') >>>
As you can see I imported requests, then I set
requests.packages.urllib3.disable_warnings() and that disabled the warning message for my script.
Related post: Fix SSL issues with pyVmomi on Python 2.7.9