且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在机械化中禁用SSL证书验证

更新时间:2022-12-08 15:22:48

在br.open()之前添加此代码段以禁用HTTPS证书验证.

Add this code snippet to disable HTTPS certificate validation before br.open().

import ssl
try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    # Legacy Python that doesn't verify HTTPS certificates by default
    pass
else:
    # Handle target environment that doesn't support HTTPS verification
    ssl._create_default_https_context = _create_unverified_https_context

对于要求解释的人们:请检查此链接.

For people asking for explanation: check this link.