@@ -45,6 +45,8 @@ class ArangoClient:
45
45
the de-serialized object. If not given, ``json.loads`` is used by
46
46
default.
47
47
:type deserializer: callable
48
+ :param verify_certificate: Verify TLS certificates.
49
+ :type verify_certificate: bool
48
50
"""
49
51
50
52
def __init__ (
@@ -55,6 +57,7 @@ def __init__(
55
57
http_client : Optional [HTTPClient ] = None ,
56
58
serializer : Callable [..., str ] = lambda x : dumps (x ),
57
59
deserializer : Callable [[str ], Any ] = lambda x : loads (x ),
60
+ verify_certificate : bool = True ,
58
61
) -> None :
59
62
if isinstance (hosts , str ):
60
63
self ._hosts = [host .strip ("/" ) for host in hosts .split ("," )]
@@ -76,6 +79,10 @@ def __init__(
76
79
self ._deserializer = deserializer
77
80
self ._sessions = [self ._http .create_session (h ) for h in self ._hosts ]
78
81
82
+ # set flag for SSL/TLS certificate verification
83
+ for session in self ._sessions :
84
+ session .verify = verify_certificate
85
+
79
86
def __repr__ (self ) -> str :
80
87
return f"<ArangoClient { ',' .join (self ._hosts )} >"
81
88
@@ -110,6 +117,7 @@ def db(
110
117
verify : bool = False ,
111
118
auth_method : str = "basic" ,
112
119
superuser_token : Optional [str ] = None ,
120
+ verify_certificate : bool = True ,
113
121
) -> StandardDatabase :
114
122
"""Connect to an ArangoDB database and return the database API wrapper.
115
123
@@ -130,6 +138,8 @@ def db(
130
138
If set, parameters **username**, **password** and **auth_method**
131
139
are ignored. This token is not refreshed automatically.
132
140
:type superuser_token: str
141
+ :param verify_certificate: Verify TLS certificates.
142
+ :type verify_certificate: bool
133
143
:return: Standard database API wrapper.
134
144
:rtype: arango.database.StandardDatabase
135
145
:raise arango.exceptions.ServerConnectionError: If **verify** was set
0 commit comments