Python is officially supported by Neo4j, who provides a driver to connect to a Neo4j graph from Python at https://github.com/neo4j/neo4j-python-driver.
It can be installed through the pip Python package manager:
pip install neo4j
# or
conda install -c conda-forge neo4j
The code for this section is available in a Jupyter notebook: Neo4j_Python_Driver.ipynb.
In order to use this database, the first step is the connection definition, which requires the active graph URI and the authentication parameters. bolt is a client-server communication protocol designed by Neo4j. The port used by the bolt protocol for your active database can be found in the Management area of your graph in Neo4j Desktop, in the Details tab:
from neo4j import GraphDatabase driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "<YOUR_PASSWORD>"))
In the case of misconfiguration, you will get the following:
- A ServiceUnavailable...