2020)
2121from arango .version import version
2222
23-
2423class ArangoClient :
2524 """ArangoDB client.
2625
@@ -45,6 +44,8 @@ class ArangoClient:
4544 the de-serialized object. If not given, ``json.loads`` is used by
4645 default.
4746 :type deserializer: callable
47+ :param verify_certificate: Verify TLS certificates.
48+ :type verify_certificate: bool
4849 """
4950
5051 def __init__ (
@@ -55,6 +56,7 @@ def __init__(
5556 http_client : Optional [HTTPClient ] = None ,
5657 serializer : Callable [..., str ] = lambda x : dumps (x ),
5758 deserializer : Callable [[str ], Any ] = lambda x : loads (x ),
59+ verify_certificate : bool = True ,
5860 ) -> None :
5961 if isinstance (hosts , str ):
6062 self ._hosts = [host .strip ("/" ) for host in hosts .split ("," )]
@@ -75,6 +77,10 @@ def __init__(
7577 self ._serializer = serializer
7678 self ._deserializer = deserializer
7779 self ._sessions = [self ._http .create_session (h ) for h in self ._hosts ]
80+
81+ # set flag for SSL/TLS certificate verification
82+ for session in self ._sessions :
83+ session .verify = verify_certificate
7884
7985 def __repr__ (self ) -> str :
8086 return f"<ArangoClient { ',' .join (self ._hosts )} >"
@@ -110,6 +116,7 @@ def db(
110116 verify : bool = False ,
111117 auth_method : str = "basic" ,
112118 superuser_token : Optional [str ] = None ,
119+ verify_certificate : bool = True ,
113120 ) -> StandardDatabase :
114121 """Connect to an ArangoDB database and return the database API wrapper.
115122
@@ -130,6 +137,8 @@ def db(
130137 If set, parameters **username**, **password** and **auth_method**
131138 are ignored. This token is not refreshed automatically.
132139 :type superuser_token: str
140+ :param verify_certificate: Verify TLS certificates.
141+ :type verify_certificate: bool
133142 :return: Standard database API wrapper.
134143 :rtype: arango.database.StandardDatabase
135144 :raise arango.exceptions.ServerConnectionError: If **verify** was set
0 commit comments