这个Python请求错误是什么意思?

人气:558 发布:2022-10-16 标签: python couchbase

问题描述

此Python请求错误是什么意思?这是否意味着它尝试连接到服务器但无法连接?[Errno 8] nodename nor servname provided, or not known是什么意思?

GET中第55行的文件"python2.7/Site-Packages/Requests/api.py"

请求中的文件"python2.7/Site-Packages/Requests/api.py",第44行

文件"python2.7/site-packages/requests/sessions.py",第279行,在 请求

文件"python2.7/site-packages/requests/sessions.py",第374行,在 发送

文件"python2.7/site-packages/requests/adapters.py",第209行,在 发送

ConnectionError:HTTPConnectionPool(host=‘localhost’,port=8091):Max 已超过url:/Pools/Default的重试次数(由:[Errno 8]节点名或未提供的服务器名引起 已知

代码生成了以下内容:http://github.com...

class RestConnection(object):
    def __init__(self, serverInfo):
        #serverInfo can be a json object
        if isinstance(serverInfo, dict):
            self.ip = serverInfo["ip"]
            self.username = serverInfo["username"]
            self.password = serverInfo["password"]
            self.port = serverInfo["port"]
            self.couch_api_base = serverInfo.get("couchApiBase")
        else:
            self.ip = serverInfo.ip
            self.username = serverInfo.rest_username
            self.password = serverInfo.rest_password
            self.port = serverInfo.port
            self.couch_api_base = None

        self.base_url = "http://{0}:{1}".format(self.ip, self.port)
        server_config_uri = ''.join([self.base_url, '/pools/default'])
        self.config = requests.get(server_config_uri).json()
        # if couchApiBase is not set earlier, let's look it up
        if self.couch_api_base is None:
            #couchApiBase is not in node config before Couchbase Server 2.0
            self.couch_api_base = self.config["nodes"][0].get("couchApiBase")
仅供参考,此错误是从Couchbase Python客户端生成的。

推荐答案

为将来遇到这种情况的人添加我自己的体验。

事实证明,这实际上是因为我已经达到了系统上打开的文件的最大数量。它与失败的连接无关,甚至与指示的DNS错误无关。

243