コード例 #1
0
 def get(self, **kwargs):
     data = u""
     if kwargs:
         data = []
         for k, v in kwargs.items():
             data.append("{}={}".format(smart_quote(k),
                                        smart_quote(json.dumps(v))))
         data = u"?{}".format(u"&".join(data))
     url = self._url.replace(
         u"labels",
         u"label/{}/nodes{}".format(smart_quote(self._label), data))
     response = Request(**self._auth).get(url)
     if response.status_code == 200:
         results_list = response.json()
         if not results_list:
             return []
         elif isinstance(results_list, (tuple, list)):
             return Iterable(self._node_cls, results_list, "self",
                             auth=self._auth)
     else:
         msg = "Unable to read label(s)"
         try:
             msg += ": " + response.json().get('message')
         except (ValueError, AttributeError, KeyError):
             pass
         raise StatusException(response.status_code, msg)
コード例 #2
0
 def relationships(self):
     from neo4jrestclient.client import Relationship
     results = self.request(Traverser.RELATIONSHIP)
     return Iterable(Relationship, results, "self")
コード例 #3
0
 def __iter__(self):
     from neo4jrestclient.client import Path
     results = self.request(Traverser.PATH)
     return Iterable(Path, results, auth=self._auth)
コード例 #4
0
 def nodes(self):
     from neo4jrestclient.client import Node
     results = self.request(Traverser.NODE)
     return Iterable(Node, results, "self", cypher=self._cypher)