diff --git a/backend/utils/request/request.py b/backend/utils/request/request.py index be802af96..80e1d11bb 100644 --- a/backend/utils/request/request.py +++ b/backend/utils/request/request.py @@ -26,11 +26,11 @@ def make_http_request( """Generic helper function to help make a HTTP request.""" try: if verb == HTTPMethod.GET: - response = pyrequests.get(url, params=params, headers=headers) + response = pyrequests.get(url, params=params, headers=headers, timeout=60) elif verb == HTTPMethod.POST: - response = pyrequests.post(url, json=data, params=params, headers=headers) + response = pyrequests.post(url, json=data, params=params, headers=headers, timeout=60) elif verb == HTTPMethod.DELETE: - response = pyrequests.delete(url, params=params, headers=headers) + response = pyrequests.delete(url, params=params, headers=headers, timeout=60) else: raise ValueError("Invalid HTTP verb. Supported verbs: GET, POST, DELETE") diff --git a/prompt-service/src/unstract/prompt_service/utils/request.py b/prompt-service/src/unstract/prompt_service/utils/request.py index c7006af38..9de16933e 100644 --- a/prompt-service/src/unstract/prompt_service/utils/request.py +++ b/prompt-service/src/unstract/prompt_service/utils/request.py @@ -27,11 +27,11 @@ def make_http_request( """Generic helper function to help make a HTTP request.""" try: if verb == HTTPMethod.GET: - response = pyrequests.get(url, params=params, headers=headers) + response = pyrequests.get(url, params=params, headers=headers, timeout=60) elif verb == HTTPMethod.POST: - response = pyrequests.post(url, json=data, params=params, headers=headers) + response = pyrequests.post(url, json=data, params=params, headers=headers, timeout=60) elif verb == HTTPMethod.DELETE: - response = pyrequests.delete(url, params=params, headers=headers) + response = pyrequests.delete(url, params=params, headers=headers, timeout=60) else: raise ValueError("Invalid HTTP verb. Supported verbs: GET, POST, DELETE") diff --git a/unstract/tool-sandbox/src/unstract/tool_sandbox/helper.py b/unstract/tool-sandbox/src/unstract/tool_sandbox/helper.py index 5967f1306..9a54e50b7 100644 --- a/unstract/tool-sandbox/src/unstract/tool_sandbox/helper.py +++ b/unstract/tool-sandbox/src/unstract/tool_sandbox/helper.py @@ -52,7 +52,7 @@ def make_get_request( """ url = f"{self.base_url}{endpoint}" params = {"image_name": image_name, "image_tag": image_tag} - response = requests.get(url, params=params) + response = requests.get(url, params=params, timeout=60) result: Optional[dict[str, Any]] = None if response.status_code == 200: result = response.json() @@ -91,7 +91,7 @@ def call_tool_handler( settings, ) - response = requests.post(url, json=data) + response = requests.post(url, json=data, timeout=60) result: Optional[dict[str, Any]] = None if response.status_code == 200: result = response.json()