使用 python requests 遇到以下错误:
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
During handling of the above exception, another exception occurred: raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='xx.com.cn', port=443): Max retries exceeded with url: /passport/login
(Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))) requests.exceptions.SSLError:
SSL错误, 可以先尝试使用以下方式解决:
1 import urllib3 2 urllib3.disable_warnings()
session.verify = False
或者
r = requests.post(url, data=body, headers=header, verify=False)