【发布时间】:2013-03-08 03:37:55
【问题描述】:
这个 Python 请求错误是什么意思?这是否意味着它尝试连接到服务器并且无法连接? [Errno 8] nodename nor servname provided, or not known 是什么意思?
文件“python2.7/site-packages/requests/api.py”,第 55 行,在获取中
文件“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 客户端生成的。
【问题讨论】:
-
你能粘贴一些触发它的周围代码吗?