From 2c6978dcdbd2b71f0a4e6bbf4235aae2c4641827 Mon Sep 17 00:00:00 2001 From: norohind <60548839+norohind@users.noreply.github.com> Date: Fri, 10 Oct 2025 12:45:20 +0300 Subject: [PATCH] Set timeout for http requests --- utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils.py b/utils.py index 8c6c4f1..eff4b56 100644 --- a/utils.py +++ b/utils.py @@ -91,6 +91,7 @@ def proxied_request(url: str, method: str = 'get', **kwargs) -> requests.Respons url=url, proxies=proxies, headers={'Authorization': f'Bearer {_get_bearer()}'}, + timeout=30, **kwargs ) @@ -124,7 +125,8 @@ def _get_bearer() -> str: :return: bearer token as str """ bearer_request: requests.Response = requests.get( - url='https://capi.demb.uk/random_token', headers={'auth': os.environ['DEMB_CAPI_AUTH']}) + url='https://capi.demb.uk/random_token', headers={'auth': os.environ['DEMB_CAPI_AUTH']}, timeout=30 + ) try: bearer: str = bearer_request.json()['access_token'] @@ -159,3 +161,4 @@ def measure(function: callable, name_to_display: str): return result return decorated +