self signed certificate in certi

2022-08-28  本文已影响0人  Ivanlfli

python报错:self signed certificate in certificate chain (_ssl.c:1131)
解决:代码里加入下面代码

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
上一篇下一篇

猜你喜欢

热点阅读