Requests 之Max retries exceeded with url[Errno 10054]错误新解
2017-10-13 23:41
323 查看
只要使用过requests模块,想必对
这是requests常见的一种错误,原因就是连接太多没有关闭导致socket超时。
一般的解读是urllib3的问题,因为requests是基于urllib3的,urllib3默认不支持长连接即keep-alive
经过排查发现,刚开了迅雷下载了很多文件,关了迅雷之后一切正常。
典型的多连接问题,当时出现错误的时候真的一脸蒙圈
Max retries exceeded with url[Errno 10054]错误都不会太陌生。
这是requests常见的一种错误,原因就是连接太多没有关闭导致socket超时。
一般的解读是urllib3的问题,因为requests是基于urllib3的,urllib3默认不支持长连接即keep-alive
解决方案一
requests.adapters.DEFAULT_RETRIES = 5
解决方案二
s = requests.session() s.keep_alive = False
新的情况
我的小爬虫其实只爬了一个页面就出现这个错误,而且并没有进行并发,也不会被封,而且几分钟前运行还正常。经过排查发现,刚开了迅雷下载了很多文件,关了迅雷之后一切正常。
典型的多连接问题,当时出现错误的时候真的一脸蒙圈
相关文章推荐
- python 爬虫‘Max retries exceeded with url’错误
- Max retries exceeded with url 错误
- HTTPSConnectionPool(host='xxxxx', port=443): Max retries exceeded with url:xxxxxxxx (Caused by NewConnectionError('<urllib3.connect,Max retries exceeded with ,(Caused by NewConnectionError
- Max retries exceeded with url
- Max retries exceeded with url
- Python使用post请求时遇到.ConnectionError: HTTPConnectionPool Max retries exceeded with url: Failed to esta
- Python requests“Max retries exceeded with url” error
- Python爬取知乎回答信息碰到:Max retries exceeded with URL
- 数据处理后的缓存清除问题:Max retries exceeded with url
- Max retries exceeded with url
- 解决Max retries exceeded with url的问题
- Max retries exceeded with ur
- 错误: 实例 "ahwater-linux-core" 执行所请求操作失败,实例处于错误状态。: 请稍后再试 [错误: Exceeded maximum number of retries. Exceeded max scheduling attempts 3 for instance 7c1609c9-9d0f-4836-85b3-cefd45f942a7. Last exception: [u
- Max retries exceeded with ur
- 对于执行Get-SPWeb遇到错误“Cannot find an SPWeb object with Id or Url”的解决方案
- Configure URLScan to Allow Requests with a Null Extension in IIS
- Python requests 多线程抓取 出现HTTPConnectionPool Max retires exceeded异常
- ECM 之 DM_WORKFLOW_E_TRANS_MAX_OUTPUT_CNT_EXCEEDED 错误分析与解决
- ECM 之 DM_WORKFLOW_E_TRANS_MAX_OUTPUT_CNT_EXCEEDED 错误分析与解决