diff --git a/libs/community/google/knowledge-graph/garf/community/google/knowledge_graph/api_clients.py b/libs/community/google/knowledge-graph/garf/community/google/knowledge_graph/api_clients.py index 2512a6ce..2683fc7c 100644 --- a/libs/community/google/knowledge-graph/garf/community/google/knowledge_graph/api_clients.py +++ b/libs/community/google/knowledge-graph/garf/community/google/knowledge_graph/api_clients.py @@ -41,7 +41,7 @@ def get_response( 'limit': 100, 'key': self.api_key, } - response = requests.get(service_url, params=params) + response = requests.get(service_url, params=params, timeout=10) results = [] for result in response.json().get('itemListElement', []): tmp_result = result.get('result') diff --git a/libs/core/garf/core/api_clients.py b/libs/core/garf/core/api_clients.py index 2f96e490..5914d436 100644 --- a/libs/core/garf/core/api_clients.py +++ b/libs/core/garf/core/api_clients.py @@ -154,7 +154,7 @@ def get_response( for param in request.filters: key, value = param.split('=') params[key.strip()] = value.strip() - response = requests.get(url, params=params, headers=kwargs) + response = requests.get(url, params=params, headers=kwargs, timeout=10) if response.status_code == self.OK: results = response.json() if not isinstance(results, list): diff --git a/libs/executors/garf/executors/entrypoints/typer_cli.py b/libs/executors/garf/executors/entrypoints/typer_cli.py index cd493764..304e2c64 100644 --- a/libs/executors/garf/executors/entrypoints/typer_cli.py +++ b/libs/executors/garf/executors/entrypoints/typer_cli.py @@ -231,7 +231,7 @@ def execute( 'context': rest_context, } try: - response = requests.post(url=endpoint, json=request, headers=headers) + response = requests.post(url=endpoint, json=request, headers=headers, timeout=10) response.raise_for_status() except requests.exceptions.HTTPError as e: raise exceptions.GarfExecutorError( @@ -250,7 +250,7 @@ def execute( 'context': rest_context, } try: - response = requests.post(url=endpoint, json=request, headers=headers) + response = requests.post(url=endpoint, json=request, headers=headers, timeout=10) response.raise_for_status() except requests.exceptions.HTTPError as e: raise exceptions.GarfExecutorError( diff --git a/libs/exporters/garf/exporter/entrypoints/cli.py b/libs/exporters/garf/exporter/entrypoints/cli.py index 7cded8d4..ca5bbaa5 100644 --- a/libs/exporters/garf/exporter/entrypoints/cli.py +++ b/libs/exporters/garf/exporter/entrypoints/cli.py @@ -59,7 +59,7 @@ def healthcheck(host: str, port: int) -> bool: Whether or not the check is successful. """ try: - res = requests.get(f'http://{host}:{port}/metrics/').text.split('\n') + res = requests.get(f'http://{host}:{port}/metrics/', timeout=5).text.split('\n') except requests.exceptions.ConnectionError: return False last_exported = [r for r in res if 'export_completed_seconds 1' in r][