Python requests“Max retries exceeded with url” error
来源:互联网 发布:乐视手机4g网络不能用 编辑:程序博客网 时间:2024/06/06 01:46
今天写python网络爬虫的时候遇到一个问题,报错的具体内容如下:
HTTPConnectionPool(host='dds.cr.usgs.gov', port=80): Max retries exceeded with url: /ltaauth//sno18/ops/l1/2016/138/037/LC81380372016038LGN00.tar.gz?id=stfb9e0bgrpmc4j9lcg45ikrj1&iid=LC81380372016038LGN00&did=227966479&ver=production (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x105b9d210>: Failed to establish a new connection: [Errno 65] No route to host',))
多方查阅后发现了解决问题的原因:http连接太多没有关闭导致的。
解决办法:
1、增加重试连接次数
requests.adapters.DEFAULT_RETRIES = 5
2、关闭多余的连接
requests使用了urllib3库,默认的http connection是keep-alive的,requests设置False关闭。
操作方法
s = requests.session() s.keep_alive = False
1 1
- Python requests“Max retries exceeded with url” error
- Max retries exceeded with url Error
- Max retries exceeded with url
- python 爬虫‘Max retries exceeded with url’错误
- Python爬取知乎回答信息碰到:Max retries exceeded with URL
- Max retries exceeded with url 错误
- Requests 之Max retries exceeded with url[Errno 10054]错误新解
- Max retries exceeded with ur
- 数据处理后的缓存清除问题:Max retries exceeded with url
- OGG-01224 TCP/IP error 111 (Connection refused); retries exceeded.
- A million requests per second with Python
- Full Text Error (FTG): Exceeded Max Configured Index Size While Indexing....
- influxdb {"error":"partial write: max-values-per-tag limit exceeded (100009/100000)
- BIP Requests Are Failing With Error "OPP Error Oracle.apps.xdo.XDOException: Error Creating Lock Fil
- max no of gateways exceeded
- python requests
- python requests
- Python Requests
- 【Java/Android】对回调机制的理解
- 傅立叶变换-MATLAB
- tableView static cells不显示
- 问题easyui树形成了死循环
- Linux学习路线规划
- Python requests“Max retries exceeded with url” error
- 第四周项目3-随机函数
- css 只改变父元素的透明度,不改变子元素透明度rgba+opacity
- 旅の途中
- 指针总结
- C/C++ 获取文件夹下的所有文件列表
- string的assign用法
- Mockito 单元测试简介以及Stub
- Centos6.5安装Oracle12c安装笔记