@@ -45,28 +45,31 @@ def __init__(self, verifySsl):
4545 self .verifySsl = verifySsl
4646
4747
48- def send_request (self , url , method , body , headers = None ,query_params = None ):
48+ def send_request (self , url , method , body , headers = None , query_params = None , timeout = None ):
4949
5050 """
5151 Makes the HTTP request using RESTClient.
5252 """
5353 if query_params :
5454 url += '?' + urlencode (query_params )
5555
56+ if timeout is None :
57+ timeout = (60 , 600 ) # 1 minute connection timeout; 10 minute response timeout
58+
5659 if method == "GET" :
57- response = requests .get (url , auth = self .auth , headers = headers , verify = self .verifySsl )
60+ response = requests .get (url , auth = self .auth , headers = headers , verify = self .verifySsl , timeout = timeout )
5861 elif method == "HEAD" :
59- response = requests .head (url , auth = self .auth , headers = headers , verify = self .verifySsl )
62+ response = requests .head (url , auth = self .auth , headers = headers , verify = self .verifySsl , timeout = timeout )
6063 elif method == "OPTIONS" :
61- response = requests .options (url , auth = self .auth , headers = headers , verify = self .verifySsl )
64+ response = requests .options (url , auth = self .auth , headers = headers , verify = self .verifySsl , timeout = timeout )
6265 elif method == "POST" :
63- response = requests .post (url , json = body , auth = self .auth , headers = headers , verify = self .verifySsl )
66+ response = requests .post (url , json = body , auth = self .auth , headers = headers , verify = self .verifySsl , timeout = timeout )
6467 elif method == "PUT" :
65- response = requests .put (url , json = body , auth = self .auth , headers = headers , verify = self .verifySsl )
68+ response = requests .put (url , json = body , auth = self .auth , headers = headers , verify = self .verifySsl , timeout = timeout )
6669 elif method == "PATCH" :
67- response = requests .patch (url , json = body , auth = self .auth , headers = headers , verify = self .verifySsl )
70+ response = requests .patch (url , json = body , auth = self .auth , headers = headers , verify = self .verifySsl , timeout = timeout )
6871 elif method == "DELETE" :
69- response = requests .delete (url , auth = self .auth , headers = headers , verify = self .verifySsl )
72+ response = requests .delete (url , auth = self .auth , headers = headers , verify = self .verifySsl , timeout = timeout )
7073 else :
7174 raise ValueError (
7275 "http method must be `GET`, `HEAD`, `OPTIONS`,"
0 commit comments