ali73
ali73

Reputation: 415

Py2neo searching error

Im still trying to make a social network with py2neo+flask+neo4j.

I've got a problem while searching my database with py2neo.I wanna find all the users that their username includes a special string.For example all the users that their username includes "dav".I wrote the code below and i dont know why i get this error...

from py2neo import Graph
graph=Graph("http://neo4j:123@localhost:7474/ ")
def search(name):
   users=graph.merge("Person")
   for N in users:
       print N['username']

and this is my error:

Traceback (most recent call last): File "", line 1, in
File "/home/ali/Desktop/flask/search.py", line 10, in search users=graph.cypher.execute('match (p:Person) return p' File "/usr/local/lib/python2.7/dist-packages/py2neo/core.py", line 659, in cypher metadata = self.resource.metadata
File "/usr/local/lib/python2.7/dist-packages/py2neo/core.py", line 213, in metadata self.get() File "/usr/local/lib/python2.7/dist-packages/py2neo/core.py", line 267, in get raise_from(self.error_class(message, **content), error)
File "/usr/local/lib/python2.7/dist-packages/py2neo/util.py", line 235, in raise_from raise exception py2neo.error.GraphError: HTTP GET returned response 404

Upvotes: 1

Views: 1281

Answers (1)

FrobberOfBits
FrobberOfBits

Reputation: 18002

Your URL is wrong, you should change it to this:

Graph("http://neo4j:123@localhost:7474/db/data")

Also, you can't execute cypher through the merge function, instead you should do this:

users = graph.cypher.execute('match (p:Person) return p')

Upvotes: 1

Related Questions