File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 17
17
from arango .cluster import Cluster
18
18
from arango .collection import StandardCollection
19
19
from arango .connection import Connection
20
+ from arango .errno import HTTP_NOT_FOUND
20
21
from arango .exceptions import (
21
22
AnalyzerCreateError ,
22
23
AnalyzerDeleteError ,
@@ -1644,12 +1645,14 @@ def has_graph(self, name: str) -> Result[bool]:
1644
1645
:return: True if graph exists, False otherwise.
1645
1646
:rtype: bool
1646
1647
"""
1647
- request = Request (method = "get" , endpoint = "/_api/gharial" )
1648
+ request = Request (method = "get" , endpoint = f "/_api/gharial/ { name } " )
1648
1649
1649
1650
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 )
1653
1656
1654
1657
return self ._execute (request , response_handler )
1655
1658
You can’t perform that action at this time.
0 commit comments