无法使用NEO4J python驱动程序连接NEO4J



我无法使用Neo4j -python-driver版本5.3.0连接到Neo4j。要求使用Neo4j python驱动程序使用密码查询Neo4j DB。它给出了连接服务器失败的错误,即使数据库已经启动并运行,我也可以通过NEO4J Desktop登录和使用。低于错误

neo4j.exceptions.ServiceUnavailable: Couldn't connect to <URI>:7687 (resolved to ()):
[SSLCertVerificationError] Connection Failed. Please ensure that your database is listening on the correct host and port and that you have enabled encryption if required. Note that the default encryption setting has changed in Neo4j 4.0. See the docs for more information. Failed to establish encrypted connection. (code 1: Operation not permitted)

注意:URI隐藏在上面的错误。

我已经在忽略证书验证问题中添加了异常,但是它不会解决这个问题。

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

感谢您帮助解决这个问题。

我正在连接下面的代码段

from neo4j import GraphDatabase
import urllib3
#Ignores certificate verification issue
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

# Initialize connection to database
driver = GraphDatabase.driver('bolt+s://<URI>:7687', auth=(',username', '<password'))

query = 'match (n:Event{name:"test"}) return n'
#Run Cypher query
with driver.session() as session:
info = session.run(query)
for item in info:
print(item)

没有办法知道你是如何连接的,但是我们知道:

from neo4j import GraphDatabase
address="bolt://localhost:7687"
auth=('neo4j', "password")
driver = GraphDatabase.driver(address, auth=auth, encrypted=False)
....

你试过py2neo吗?我使用下面的dev运行在docker和prod运行Aura。

from py2neo import Graph
self.graph = Graph(os.getenv('DB_URI'), auth=(
os.getenv('DB_USER'), os.getenv('DB_PASS')))

DB_URI是'neo4j://0.0.0.0:7687和'neo4j+s://xxxx'在prod

最新更新