Python使用requests时遇到Failed to establish a new connection

Python使用requests时,开启太多的connection会遇到这样一个错误

requests.exceptions.ConnectionError: HTTPConnectionPool(host='xxxx', port=xxxx):
    Max retries exceeded with url: /xxxx (Caused by NewConnectionError
    ('<requests.packages.urllib3.connection.HTTPConnection object at 0x29b44d0>:
    Failed to establish a new connection:
    [Errno 99] Cannot assign requested address',))

在短时间使用多次requests.post

修改如下

requests..get("http://...", headers={'Connection':'close'})
requests..post("http://...", headers={'Connection':'close'})

Python使用requests時遇到Failed to establish a new connection


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 bin07280@qq.com

文章标题:Python使用requests时遇到Failed to establish a new connection

文章字数:111

本文作者:Bin

发布时间:2017-12-17, 22:12:07

最后更新:2019-08-06, 00:07:35

原始链接:http://coolview.github.io/2017/12/17/Python/Python%E4%BD%BF%E7%94%A8requests%E6%99%82%E9%81%87%E5%88%B0Failed-to-establish-a-new-connection/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录