From da86e366a9229be63bc67b3eba15e2006f73a917 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sun, 25 Jun 2023 15:05:40 +0300 Subject: [PATCH] Set some timeouts for initial connection to instance --- src/fw_api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fw_api.py b/src/fw_api.py index fc7f697..12c315f 100644 --- a/src/fw_api.py +++ b/src/fw_api.py @@ -48,7 +48,7 @@ class current_instance: current_instance.token = new_token current_instance.listen_token = None if new_token: - current_instance.s.get(f'https://{current_instance.instance}') + current_instance.s.get(f'https://{current_instance.instance}', timeout=30) current_instance.s.headers.update({"Authorization": "Bearer " + new_token}) @@ -56,7 +56,7 @@ if current_instance.token: current_instance.s.headers.update({"Authorization": "Bearer " + current_instance.token}) else: # Get cookies from unauthorized instance for working some functionality (radios) - current_instance.s.get(f'https://{current_instance.instance}/') + current_instance.s.get(f'https://{current_instance.instance}/', timeout=30) @logger.catch @@ -79,7 +79,8 @@ def get_instance_settings(): def get_node_info(): r = current_instance.s.get( - f'https://{current_instance.instance}/api/v1/instance/nodeinfo/2.0/') + f'https://{current_instance.instance}/api/v1/instance/nodeinfo/2.0/', + timeout=30) r.raise_for_status() return r.json()