@@ -53,6 +53,12 @@ class ArangoClient:
5353 False: Do not verify TLS certificate.
5454 str: Path to a custom CA bundle file or directory.
5555 :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
5662 """
5763
5864 def __init__ (
@@ -64,6 +70,7 @@ def __init__(
6470 serializer : Callable [..., str ] = lambda x : dumps (x ),
6571 deserializer : Callable [[str ], Any ] = lambda x : loads (x ),
6672 verify_override : Union [bool , str , None ] = None ,
73+ request_timeout : Any = 60 ,
6774 ) -> None :
6875 if isinstance (hosts , str ):
6976 self ._hosts = [host .strip ("/" ) for host in hosts .split ("," )]
@@ -80,7 +87,13 @@ def __init__(
8087 else :
8188 self ._host_resolver = RoundRobinHostResolver (host_count , resolver_max_tries )
8289
90+ # Initializes the http client
8391 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+
8497 self ._serializer = serializer
8598 self ._deserializer = deserializer
8699 self ._sessions = [self ._http .create_session (h ) for h in self ._hosts ]
@@ -117,6 +130,20 @@ def version(self) -> str:
117130 version : str = get_distribution ("python-arango" ).version
118131 return version
119132
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+
120147 def db (
121148 self ,
122149 name : str = "_system" ,
0 commit comments