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

前端 未结 9 1061
南方客
南方客 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:41

    The correct way is to read the relevant section on the provided link and do as it says. The way specific for requests (which bundles with its own copy of urllib3), as per CA Certificates — Advanced Usage — Requests 2.8.1 documentation:

    • requests ships with its own certificate bundle (but it can only be updated together with the module)
    • it will use (since requests v2.4.0) the certifi package instead if it's installed

    The HTTPS certificate verification security measure isn't something to be discarded light-heartedly. The Man-in-the-middle attack that it prevents safeguards you from a third party e.g. sipping a virus in or tampering with or stealing your data.

    Which, with today's government-backed global hacking operations like Tailored Access Operations and the Great Firewall of China that target network infrastructure, is more probable than you think.

提交回复
热议问题