python request SSL error 403证书错误

requests.exceptions.SSLError: HTTPSConnectionPool(host=’xx.xx.xx.xx’, port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1056)’)))

解决方案: 添加参数 verify=False

from requests import session

link = "https://www.example.com"

s = session()
r = s.get(link,verify=False)
r.encoding = "utf-8"

print(r.text)

    原文作者:123hello123
    原文地址: https://blog.csdn.net/qq_43615820/article/details/124089123
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞