I was following simple py2neo tutorial here: http://nicolewhite.github.io/neo4j-jupyter/hello-world.html
Everything worked fine, all the entries appear in the neo4j in-browser version, however when I try to run inline Cypher queries, I get a 404 error.
%%cypher
http://neo4j:password@localhost:7474/db/data/
MATCH (person:Person)-[:LIKES]->(drink:Drink)
RETURN person.name, drink.name, drink.calories
Here's the traceback:
Format: (http|https)://username:password@hostname:port/db/name
---------------------------------------------------------------------------
NotFoundError Traceback (most recent call last)
<ipython-input-12-de2d5705ff61> in <module>
----> 1 get_ipython().run_cell_magic('cypher', '', 'http://neo4j:password@localhost:7474/db/data/\nMATCH (person:Person)-[:LIKES]->(drink:Drink)\nRETURN person.name, drink.name, drink.calories\n')
~/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2369 with self.builtin_trap:
2370 args = (magic_arg_s, cell)
-> 2371 result = fn(*args, **kwargs)
2372 return result
2373
<decorator-gen-127> in execute(self, line, cell, local_ns)
~/.local/lib/python3.6/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):
<decorator-gen-126> in execute(self, line, cell, local_ns)
~/.local/lib/python3.6/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):
~/.local/lib/python3.6/site-packages/cypher/magic.py in execute(self, line, cell, local_ns)
106 user_ns.update(local_ns)
107 parsed = parse("""{0}\n{1}""".format(line, cell), self)
--> 108 conn = Connection.get(parsed['as'] or parsed['uri'], parsed['as'])
109 first_word = parsed['cypher'].split(None, 1)[:1]
110 if first_word and first_word[0].lower() == 'persist':
~/.local/lib/python3.6/site-packages/cypher/connection.py in get(cls, descriptor, alias)
45 cls.current = conn
46 else:
---> 47 cls.current = Connection(descriptor, alias)
48 if cls.current:
49 return cls.current
~/.local/lib/python3.6/site-packages/cypher/connection.py in __init__(self, connect_str, alias)
24 gdb = GraphDatabase(self.connections[connect_str])
25 else:
---> 26 gdb = GraphDatabase(connect_str)
27 alias = alias or connect_str
28 except:
~/.local/lib/python3.6/site-packages/neo4jrestclient/client.py in __init__(self, url, username, password, cert_file, key_file)
81 response_json = response.json()
82 else:
---> 83 raise NotFoundError(response.status_code, "Unable get root")
84 if "data" in response_json and "management" in response_json:
85 response = Request(**self._auth).get(response_json["data"])
NotFoundError: Code [404]: Not Found. Nothing matches the given URI.
Unable get root
I tried checking if the URI works according to this answer here , and I get 404 error there too:
~$ curl -i --user neo4j:password http://localhost:7474/db/data/
HTTP/1.1 404 Not Found
Access-Control-Allow-Origin: *
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=iso-8859-1
Content-Length: 0
I tried setting the Graph
option to include the link, but it didn't help:
graph = Graph("http://neo4j:password@localhost:7474/db/data/")
Could you please tell me where have I made a mistake?
I am using py2neo most of the time. Here is how I connect to my local neo4j db.
from py2neo import Graph
graph = Graph("bolt://localhost:7687", auth=("neo4j", "xxxxx"))
try:
graph.run("Match () Return 1 Limit 1")
print('ok')
except Exception:
print('not ok')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.