requests.exceptions.SSLError: HTTPSConnectionPool(host=‘edith.xiaohongshu.com‘, port=443): Max retri

使用Charles爬取某APP时报错requests.exceptions.SSLError: HTTPSConnectionPool(host='edith.xiaohongshu.com', port=443): Max retries exceeded with url: /api/sns/v1/search/hot_list (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1125)')))

遍查资料后得知是因为需要验证,所以在请求的时候将verify=False,即关闭验证,请求成功

代码如下:

url = 'xxxxx……'
r = requests.get(url,verifu=False)  #跳过验证即可

你可能感兴趣的:(python)