跟着网上教程学爬虫的时候,写了跟视频一摸一样的代码,但是遇到了以下报错,尝试用了{“connection”:"close"} 还是没用
报错如下:
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
requests.exceptions.ConnectionError: HTTPConnectionPool(host='scxk.nmpa.gov.cn', port=81): Max retries exceeded with url: /xk/itownet/portalAction.do?method=getXkzsList (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000294E00AC0A0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
可能的原因:网络不好,超时断开,或者对方服务器有限制爬虫,你慢一点爬,过一会重试,换一个ip
建议你尝试下,打开vpn的全局代理,重启jupyter notebook,因为PAC智能代理并不能在程序中使用。
具体参考: 用python对twitter进行数据挖掘之TimeoutError_baoFeng_Li的博客-CSDN博客 问题一:TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connectio n failed because connected host h... https://blog.csdn.net/CrozonKDD/article/details/80417883
请求次数过多 被远程服务器拒绝连接了
麻烦你把网线接上。哈哈