AWS Neptune python gremlin 证书验证失败

AWS Neptune python gremlin certificate verify failed

我已经设置了从本地计算机到海王星数据库的 ssh 隧道,并使用端点建立了连接。 ssh -L 8182:***.us-east-1.neptune.amazonaws.com:8182 ****

我看到 gremlin 控制台工作正常,我可以 运行 图形查询但是当我尝试使用 python 代码时,我看到一些证书验证失败。

    try:
        graph = Graph()
        remoteConn = DriverRemoteConnection(
            'wss://localhost:8182/gremlin', 'g')
        g = graph.traversal().withRemote(remoteConn)
        result = g.V().has('customer', 'customerId', 12549).out().valueMap().toList()
        print(result)
        remoteConn.close()
        return result
    except Exception as e:

异常: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1123)

请指教

PFA Screenshot

如果您通过 SSH 连接到 Neptune 并使用 HTTPS,则需要将 Neptune 集群的名称添加到本地主机文件,以便可以解析 SSL 证书链。然后不要使用 localhost,而是在 Python 代码中使用集群的实际名称。主机条目将如下所示:

127.0.0.1 localhost my.cluster-xxxxxxxxxxxx.us-east-1.neptune.amazonaws.com