这是我的代码
import requests;
url='that website';
headers={
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Language':'zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7',
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
};
r = requests.get(url,headers=headers);
print(r);
print(r.status_code);
然后它碰到了这个:
requests.exceptions.SSLError:HTTPSConnectionPool(host ='www.xxxxxx.com',port = 44 3):使用url:xxxxxxxx超出最大重试次数(由SSLEr ror引起(SSLCertVerificationError(1,'[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败) :无法获得本地颁发者证书(_ssl.c:1045)')))
我该怎么办?
快速解决:
requests.get('https://example.com', verify=False)
希望有帮助。