From 781d4f428dd7e216f6f046c54cb594cc71e8fe96 Mon Sep 17 00:00:00 2001 From: Vadim Torchin Date: Thu, 19 Feb 2026 09:40:32 +0400 Subject: [PATCH] fix: use timeouts in REST clients --- languages/python/templates/rest.mustache | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/languages/python/templates/rest.mustache b/languages/python/templates/rest.mustache index f0e0fec..4b2157c 100644 --- a/languages/python/templates/rest.mustache +++ b/languages/python/templates/rest.mustache @@ -104,6 +104,7 @@ class RESTClientObject: url, data=request_body, headers=headers, + timeout=_request_timeout, ) elif content_type == 'application/x-www-form-urlencoded': r = self.session.request( @@ -111,6 +112,7 @@ class RESTClientObject: url, params=post_params, headers=headers, + timeout=_request_timeout, ) elif content_type == 'multipart/form-data': # must del headers['Content-Type'], or the correct @@ -124,6 +126,7 @@ class RESTClientObject: url, files=post_params, headers=headers, + timeout=_request_timeout, ) # Pass a `string` parameter directly in the body to support # other content types than JSON when `body` argument is @@ -134,6 +137,7 @@ class RESTClientObject: url, data=body, headers=headers, + timeout=_request_timeout, ) elif headers['Content-Type'].startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" @@ -141,7 +145,9 @@ class RESTClientObject: method, url, data=request_body, - headers=headers) + headers=headers, + timeout=_request_timeout, + ) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -155,6 +161,7 @@ class RESTClientObject: url, params={}, headers=headers, + timeout=_request_timeout, ) except requests.exceptions.SSLError as e: msg = "\n".join([type(e).__name__, str(e)])