美文网首页
equests.exceptions.ConnectionErr

equests.exceptions.ConnectionErr

作者: gz_tester | 来源:发表于2019-06-27 11:44 被阅读0次

出现的问题

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='salesp.sunlands.wang', port=443): Max retries exceeded with url: /salesplatform-web-api/sales-users/_self (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f9e77ac5390>: Failed to establish a new connection: [Errno -2] Name or service not known',))

原因

使用url:超出了最大重试次数

解决方法

    def __init__(self):
        requests.adapters.DEFAULT_RETRIES = 5  # 增加重连次数
        self.s = requests.session()
        self.s.keep_alive = False  # 关闭多余连接

相关文章

网友评论

      本文标题:equests.exceptions.ConnectionErr

      本文链接:https://www.haomeiwen.com/subject/zvblcctx.html