Reputation: 119
I am using an example script to connect to the neo4j server and after that run a query. But I am getting this error:
C:\cygwin\lib\python2.7\site-packages\neo4j\v1\session.py:94: UserWarning: Bolt over TLS is only available in Python 2.7.9+ and Python 3.3+ so communications are not secure
warn("Bolt over TLS is only available in Python 2.7.9+ and Python 3.3+ "
Traceback (most recent call last): File "C:\Users\FTS.fts-gnosis\workspace\hello1\tester.py", line 3, in session = driver.session() File "C:\cygwin\lib\python2.7\site-packages\neo4j\v1\session.py", line 148, in session session = Session(self) File "C:\cygwin\lib\python2.7\site-packages\neo4j\v1\session.py", line 461, in init self.connection = connect(driver.host, driver.port, driver.ssl_context, **driver.config) File "C:\cygwin\lib\python2.7\site-packages\neo4j\v1\connection.py", line 384, in connect s = create_connection((host, port)) File "C:\Python27\lib\socket.py", line 553, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11004] getaddrinfo failed
Example code :
from neo4j.v1 import GraphDatabase, basic_auth
driver = GraphDatabase.driver("bolt://http://localhost:7474", auth=basic_auth("neo4j", "neo"))
session = driver.session()
result = session.run("MATCH (label:OFFICER)-[r]->() WHERE label.NAME = 'Prinza Limited' RETURN label,r")
print result
session.close()
Upvotes: 1
Views: 3903
Reputation: 20185
The driver only support Bolt, so no http possible.
Your connection uri mixes the two protocols, change to this :
driver = GraphDatabase.driver("bolt://localhost",auth=basic_auth("neo4j", "neo"))
session = driver.session()
Normally, by just following the example in the repository readme, you shouldn't have the http in the connection uri : https://github.com/neo4j/neo4j-python-driver#example-usage
Upvotes: 4