HTTPConnectionPool(host='xx.xx.xx.xx', port=xx): Max retries exceeded with url:(Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x0000015A25025EB8>...))
HTTPConnectionPool(host='xx.xx.xx.xx', port=xx): Max retries exceeded with url:(Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x0000015A25025EB8>, 'Connection to xx.xx.xx.xx timed out. (connect timeout=10)'))
网查说是http连接太多没有关闭导致的
解决办法:
1、增加重试连接次数
requests.adapters.DEFAULT_RETRIES = 5
2、关闭多余的连接
requests使用了urllib3库,默认的http connection是keep-alive的,requests设置False关闭。
s = requests.session()
s.keep_alive = False
网搜的解决方案,我的代码在for循环里不断post url,的确是打开了很多连接没关闭。
不知道是不是这个原因,加上上述3行代码之后,代码跑完了。
除上述改动外,timeout由原来的10改为了30。
还有另外一种说法是在上述3行代码基础上再挂代理,代理设置一下proxies参数即可,不贴代码了。
不过没有尝试,可用的免费代理比较少,效率会非常低,不管有用否,不尝试了。
unfortunately,第二次再跑又报如下错误:
HTTPConnectionPool(host=''xx.xx.xx.xx', port=xx): Max retries exceeded with url: (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000237EE44EF98>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反 应,连接尝试失败。',))
太晚了,先睡了,回头再说吧。
HTTPConnectionPool(host='xx.xx.xx.xx', port=xx): Max retries exceeded with url:(Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x0000015A25025EB8>...))的更多相关文章
- HTTPSConnectionPool(host='xxxxx', port=443): Max retries exceeded with url:xxxxxxxx (Caused by NewConnectionError('<urllib3.connect,Max retries exceeded with ,(Caused by NewConnectionError
HTTPSConnectionPool(host='f6ws-sha8re-o88k.s3.ama66zaws.com', port=443): Max retries exceeded with u ...
- 关于python3.6上传文件时报错:HTTPSConnectionPool(host='***.org', port=443): Max retries exceeded with url: /post (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAIL解决办法
第一个报错: 最近在练习post请求中上传文件时遇到了一个奇葩事情,两台电脑上写了一模一样的代码,一个运行正常,另一个一片红. 最后了解了一下原因以及解决办法.先记录下关键代码: files = {& ...
- windows环境pip安装时一直报错Could not fetch URL https://pypi.org/simple/xrld/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url:
最近项目不忙了~~有开始专研的python大业,上来想用pip安装一个第三方的库,就一直报错: Could not fetch URL https://pypi.org/simple/xrld/: T ...
- HTTPConnectionPool(host:XX)Max retries exceeded with url 解决方法
爬虫多次访问同一个网站一段时间后会出现错误 HTTPConnectionPool(host:XX)Max retries exceeded with url '<requests.package ...
- HTTPConnectionPool(host:XX)Max retries exceeded with url
爬虫多次访问同一个网站一段时间后会出现错误 HTTPConnectionPool(host:XX)Max retries exceeded with url '<requests.package ...
- 安装xlrd包的时候,总是报错:ERROR: Could not install packages due to an EnvironmentError: HTTPConnectionPool (host='127.0.0.1', port=8888):。。。
安装xlrd包的时候,总是报错:ERROR: Could not install packages due to an EnvironmentError: HTTPConnectionPool (ho ...
- Python requests 多线程抓取 出现HTTPConnectionPool Max retires exceeded异常
https://segmentfault.com/q/1010000000517234 -- ::, - oracle - ERROR - data format error:HTTPConnecti ...
- Prelogin error: host 127.0.0.1 port 1434 Error reading prelogin response: Connection reset ClientConnectionId:26d4b559-c985-4b2e-bd8e-dd7a53b67e48
我在使用SSM框架的时候,连接的是sqlserver 2008r2数据库,但是查询数据的时候总是出现这样的警告信息,导致的结果是第一次登录的时候获取数据慢或者获取数据失败,具体的log信息如下 警告: ...
- Python:requests:详解超时和重试
网络请求不可避免会遇上请求超时的情况,在 requests 中,如果不设置你的程序可能会永远失去响应.超时又可分为连接超时和读取超时. 连接超时 连接超时指的是在你的客户端实现到远端机器端口的连接时( ...
随机推荐
- iOS之HTTP和HTTPS的基本知识和应用
HTTPS的基本使用 1.https简单说明HTTPS(全称:Hyper Text Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道 ...
- tensorflow中一种融合多个模型的方法
1.使用场景 假设我们有训练好的模型A,B,C,我们希望使用A,B,C中的部分或者全部变量,合成为一个模型D,用于初始化或其他目的,就需要融合多个模型的方法 2.如何实现 我们可以先声明模型D,再创建 ...
- 将RAC软件转换为单实例软件
将RAC软件转换为单实例软件 http://blog.itpub.net/26736162/viewspace-2155632/ 1. Stop database and CRS on both no ...
- oracle 子查询中null的问题(in 和 not in)
这里的in后面的句子可以理解为or拼接,简单举例即 in (9566,9839,null)可以等价于mgr=9566 or mgr=9839 or mgr=null, not in (9566,983 ...
- MySQL 数据热备份
mysqlhotcopy使用lock tables.flush tables和cp或scp来快速备份数据库.它是备份数据库或单个表最快的途径,完全属于物理备份,但只能运行在数据库目录所在的机器上. 与 ...
- 转:SQL Server 动态行转列
http://www.cnblogs.com/gaizai/p/3753296.html http://www.cnblogs.com/maanshancss/archive/2013/03/13/2 ...
- java基础---->String和MessageFormat的format方法
这里介绍一下String和MessageFormat中的format方法的差异以及实现原理. String与MessageFormat的说明 一.两者的使用场景 String.format:for l ...
- 解决macOS git clone Azure DevOps提示身份认证失败问题
macOS的终端输入git clone对应Azure DevOps的Git地址,紧接着输入正确的用户名和密码仍然会提示认证失败.解决的方法是安装微软的Git-Credential-Manager.由于 ...
- react 使用 lazyload 懒加载图片
文档地址 index.html <script> (function(w, d) { var b = d.getElementsByTagName("body")[0] ...
- ajax里post 设置请求头的编码格式
我们常用的ajax形式就是post和get.post需要设置请求头,那么问题来了: 首先,为什么get不需要设置编码格式? 其次:不设置post请求头编码格式可以吗? 还有:常用的请求头编码格式有哪些 ...