如果未安装,
pip install cryptography
pip install pyOpenSSL
pip install certifi
verify=False
如下
requests.get(url, headers=headers, timeout=30,verify=False)
在header中不使用持久连接
header中添加
headers ={
'Connection': 'close'
}
try:
response = requests.get(url)
except requests.exceptions.ConnectionError:
requests.status_code = "Connection refused"
访问速度过快
1. 更换IP
2.加入时间延时time.sleep()
3.使用随机的UA