Skip to content

Instantly share code, notes, and snippets.

@ynadji
Created September 30, 2012 15:54
Show Gist options
  • Save ynadji/3807239 to your computer and use it in GitHub Desktop.
Save ynadji/3807239 to your computer and use it in GitHub Desktop.
In [64]: srcnode = db.get_or_create_indexed_node('misc', 'source', 'sunbelt', {'src': 'sunbelt'})
---------------------------------------------------------------------------
BadRequest Traceback (most recent call last)
/home/ynadji/method/<ipython console> in <module>()
/home/ynadji/method/lib/python2.7/site-packages/py2neo/neo4j.pyc in get_or_create_indexed_node(self, index, key, value, properties)
697 """
698 index = self.get_or_create_index(Node, index)
--> 699 return index.get_or_create(key, value, properties or {})
700
701 def get_indexed_relationship(self, index, key, value):
/home/ynadji/method/lib/python2.7/site-packages/py2neo/neo4j.pyc in get_or_create(self, key, value, abstract)
1616 ..
1617 """
-> 1618 rs = self._create_unique(key, value, abstract)
1619 return self._content_type(rs.body["self"], self._graph_db)
1620
/home/ynadji/method/lib/python2.7/site-packages/py2neo/neo4j.pyc in _create_unique(self, key, value, abstract)
1590 raise TypeError(self._content_type)
1591 return self._send(rest.Request(
-> 1592 self._graph_db, "POST", str(self._uri) + "?unique", body)
1593 )
1594
/home/ynadji/method/lib/python2.7/site-packages/py2neo/rest.pyc in _send(self, request)
370 ""
371 try:
--> 372 return self._client().send(request)
373 except socket.error as err:
374 raise SocketError(err)
/home/ynadji/method/lib/python2.7/site-packages/py2neo/rest.pyc in send(self, request, *args, **kwargs)
316 except ValueError:
317 rs_body = None
--> 318 return Response(request.graph_db, rs.status, request.uri, rs.getheader("Location", None), rs_body)
319
320
/home/ynadji/method/lib/python2.7/site-packages/py2neo/rest.pyc in __init__(self, graph_db, status, uri, location, body)
243 self.body = body
244 elif self.status == 400:
--> 245 raise BadRequest(body)
246 elif self.status == 404:
247 raise ResourceNotFound(uri)
BadRequest: BadInputException: java.lang.String cannot be cast to java.util.Map
In [65]: srcnode = db.get_or_create_indexed_node('misc', 'source', 'sunbelt', {'src': 'sunbelt'})
Out[65]: Node('http://localhost:7474/db/data/node/8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment