File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1717from arango .cluster import Cluster
1818from arango .collection import StandardCollection
1919from arango .connection import Connection
20+ from arango .errno import HTTP_NOT_FOUND
2021from arango .exceptions import (
2122 AnalyzerCreateError ,
2223 AnalyzerDeleteError ,
@@ -1644,12 +1645,14 @@ def has_graph(self, name: str) -> Result[bool]:
16441645 :return: True if graph exists, False otherwise.
16451646 :rtype: bool
16461647 """
1647- request = Request (method = "get" , endpoint = "/_api/gharial" )
1648+ request = Request (method = "get" , endpoint = f "/_api/gharial/ { name } " )
16481649
16491650 def response_handler (resp : Response ) -> bool :
1650- if not resp .is_success :
1651- raise GraphListError (resp , request )
1652- return any (name == graph ["_key" ] for graph in resp .body ["graphs" ])
1651+ if resp .is_success :
1652+ return True
1653+ if resp .status_code == HTTP_NOT_FOUND :
1654+ return False
1655+ raise GraphListError (resp , request )
16531656
16541657 return self ._execute (request , response_handler )
16551658
You can’t perform that action at this time.
0 commit comments