@@ -53,6 +53,12 @@ class ArangoClient:
53
53
False: Do not verify TLS certificate.
54
54
str: Path to a custom CA bundle file or directory.
55
55
:type verify_override: Union[bool, str, None]
56
+ :param request_timeout: This is the default request timeout (in seconds)
57
+ for http requests issued by the client if the parameter http_client is
58
+ not secified. The default value is 60.
59
+ None: No timeout.
60
+ int: Timeout value in seconds.
61
+ :type request_timeout: Any
56
62
"""
57
63
58
64
def __init__ (
@@ -64,6 +70,7 @@ def __init__(
64
70
serializer : Callable [..., str ] = lambda x : dumps (x ),
65
71
deserializer : Callable [[str ], Any ] = lambda x : loads (x ),
66
72
verify_override : Union [bool , str , None ] = None ,
73
+ request_timeout : Any = 60 ,
67
74
) -> None :
68
75
if isinstance (hosts , str ):
69
76
self ._hosts = [host .strip ("/" ) for host in hosts .split ("," )]
@@ -80,7 +87,13 @@ def __init__(
80
87
else :
81
88
self ._host_resolver = RoundRobinHostResolver (host_count , resolver_max_tries )
82
89
90
+ # Initializes the http client
83
91
self ._http = http_client or DefaultHTTPClient ()
92
+ # Sets the request timeout.
93
+ # This call can only happen AFTER initializing the http client.
94
+ if http_client is None :
95
+ self .request_timeout = request_timeout
96
+
84
97
self ._serializer = serializer
85
98
self ._deserializer = deserializer
86
99
self ._sessions = [self ._http .create_session (h ) for h in self ._hosts ]
@@ -117,6 +130,20 @@ def version(self) -> str:
117
130
version : str = get_distribution ("python-arango" ).version
118
131
return version
119
132
133
+ @property
134
+ def request_timeout (self ) -> Any :
135
+ """Return the request timeout of the http client.
136
+
137
+ :return: Request timeout.
138
+ :rtype: Any
139
+ """
140
+ return self ._http .REQUEST_TIMEOUT # type: ignore
141
+
142
+ # Setter for request_timeout
143
+ @request_timeout .setter
144
+ def request_timeout (self , value : Any ) -> None :
145
+ self ._http .REQUEST_TIMEOUT = value # type: ignore
146
+
120
147
def db (
121
148
self ,
122
149
name : str = "_system" ,
0 commit comments