我正在 ICIJ 的巴拿马论文上着手一个关于 Neo4j 数据库的自我探索项目。
目标:我想在 Neo4j 上找到的数据库上运行进行网络分析的 python 包,例如 graph-tool、networkx。
因此,这些是我采取的步骤:
- 加载我确实加载的 Neo4j 驱动程序
- 通过pycharm连接Neo-4j沙箱
这是代码:
#
from neo4j.v1 import GraphDatabase, basic_auth
driver = GraphDatabase.driver(
"bolt://34.239.248.240:33621",
auth=basic_auth("neo4j", "fares-documentation-reproductions"))
session = driver.session()
# What are the Entities in Panama Papers?
cypher_query = '''
MATCH (e:Entity)
RETURN e.name AS name LIMIT $limit
'''
results = session.run(cypher_query,
parameters={"limit": 10})
for record in results:
print(record['name'])
#
这是显示的错误消息:
neo4j.exceptions.ServiceUnavailable:无法获取到地址的连接(主机='34.239.248.240',端口=33621)
我从沙盒网站获得了 bolt/port/host: https ://neo4j.com/sandbox-v2/
另外,我尝试检查 neo4j-driver 是否已正确安装,并运行了 testdriver 代码:
#
from neo4j.v1 import GraphDatabase
uri = "bolt://localhost:7474"
driver = GraphDatabase.driver(uri, auth=("neo4j", "user"))
def print_friends_of(name):
with driver.session() as session:
with session.begin_transaction() as tx:
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) "
"WHERE a.name = {name} "
"RETURN f.name", name=name):
print(record["f.name"])
print_friends_of("Alice")
#
其中显示了此错误代码:
neo4j.exceptions.SecurityError: 无法建立到“[SSL: UNKNOWN_PROTOCOL] 未知协议 (_ssl.c:749)”的安全连接
你能建议吗?