From 6e7866bb9f22e9196d45a93a09e5f41a622f590d Mon Sep 17 00:00:00 2001 From: Wenzhe Xue Date: Wed, 21 Feb 2024 15:30:40 -0800 Subject: [PATCH] convert time env var to int --- log10/load.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/log10/load.py b/log10/load.py index 32d1af66..9116d0a5 100644 --- a/log10/load.py +++ b/log10/load.py @@ -74,10 +74,8 @@ def post_request(url: str, json_payload: dict = {}) -> requests.Response: headers = {"x-log10-token": token, "Content-Type": "application/json"} json_payload["organization_id"] = org_id try: - # todo: set timeout - res = requests.post( - url, headers=headers, json=json_payload, timeout=os.environ.get("LOG10_REQUESTS_TIMEOUT", 10) - ) + timeout = int(os.environ.get("LOG10_REQUESTS_TIMEOUT", 10)) + res = requests.post(url, headers=headers, json=json_payload, timeout=timeout) # raise_for_status() will raise an exception if the status is 4xx, 5xxx res.raise_for_status()