py2neo v4无法连接到Graphenedb

时间:2018-04-17 16:31:16

标签: python neo4j py2neo

我可以使用版本3连接到graphenedb(因为我无法使用v4连接),但是在使用git install重新安装v4后,我现在无法登录。我遵循文档中推荐的登录方法,下面是我的代码。

我使用的是ubuntu 16.04和python版本3.5.2。

我在代码中有帐户和密码,因为它是一个测试数据库,您可以使用它进行测试。谢谢!

from py2neo import Graph

uri='bolt://hobby-decofbokkgfdgbkemhfoical.dbs.graphenedb.com:24786'
user='Sen'
pwd='b.QS1afdAYIUnb.FWIkIyENscjeVzMJ'

graph = Graph(uri, auth=(user, pwd), port=24786)

响应就是这样,

S: [CLOSE]
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/py2neo/database.py", line 89, in __new__
    inst = cls._instances[key]
KeyError: '8e260f1265ad91eb60c4ceb775be7ba2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "graphObjects.py", line 7, in <module>
    graph = Graph(uri, auth=(user, pwd), port=24786)
  File "/usr/local/lib/python3.5/dist-packages/py2neo/database.py", line 307, in __new__
    database = Database(uri, **settings)
  File "/usr/local/lib/python3.5/dist-packages/py2neo/database.py", line 98, in __new__
    user_agent=connection_data["user_agent"])
  File "/usr/local/lib/python3.5/dist-packages/neo4j/v1/api.py", line 125, in driver
    return driver_class(uri, **config)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/v1/direct.py", line 69, in __init__
    pool.release(pool.acquire())
  File "/usr/local/lib/python3.5/dist-packages/neo4j/v1/direct.py", line 44, in acquire
    return self.acquire_direct(self.address)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/bolt/connection.py", line 453, in acquire_direct
    connection = self.connector(address, self.connection_error_handler)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/v1/direct.py", line 66, in connector
    return connect(address, security_plan.ssl_context, error_handler, **config)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/bolt/connection.py", line 707, in connect
    raise last_error
  File "/usr/local/lib/python3.5/dist-packages/neo4j/bolt/connection.py", line 699, in connect
    connection = _handshake(s, resolved_address, der_encoded_server_certificate, error_handler, **config)
  File "/usr/local/lib/python3.5/dist-packages/neo4j/bolt/connection.py", line 655, in _handshake
    raise ProtocolError("Connection to %r closed without handshake response" % (resolved_address,))
neo4j.exceptions.ProtocolError: Connection to ('54.86.53.94', 24786) closed without handshake response

谢谢!

1 个答案:

答案 0 :(得分:1)

您的Neo4J实例正在使用TLS进行螺栓连接,但您的py2neo不是。

该回溯是尝试使用正常的未加密连接连接到TLS服务器的特征。

为了解决这个问题,请告诉py2neo你的螺栓连接应该使用TLS,方法是将secure=True传递给Graph实例的初始化:

graph = Graph(uri, auth=(user, pwd), port=24786, secure=True)