这个 Python 请求错误是什么意思?这是否意味着它尝试连接到服务器并且无法连接?是什么[Errno 8] nodename nor servname provided, or not known
意思?
文件“python2.7/site-packages/requests/api.py”,第 55 行,在 get
请求中的文件“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 retries exceeded with url: /pools/default (由: [Errno 8] nodename or servname provided, or not known
代码生成了这个: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 客户端生成的。