self signed certificate in certificate chain (_ssl.c:1131)

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

你可能感兴趣的:(self signed certificate in certificate chain (_ssl.c:1131))