From 0ee3f7ac13e4531e244f9482b2ee7ac59a09f19d Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Mon, 1 Jul 2024 14:48:00 +0200 Subject: [PATCH] chg: [backend] Print connection errors on terminal --- misp_api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misp_api.py b/misp_api.py index e3ce343..457f188 100644 --- a/misp_api.py +++ b/misp_api.py @@ -21,7 +21,8 @@ def get(url, data={}, api_key=misp_apikey): full_url = urljoin(misp_url, url) try: response = requests.get(full_url, data=data, headers=headers, verify=not misp_skipssl) - except requests.exceptions.ConnectionError: + except requests.exceptions.ConnectionError as e: + print(e) return None return response.json() if response.headers['content-type'].startswith('application/json') else response.text @@ -36,7 +37,8 @@ def post(url, data={}, api_key=misp_apikey): full_url = urljoin(misp_url, url) try: response = requests.post(full_url, data=json.dumps(data), headers=headers, verify=not misp_skipssl) - except requests.exceptions.ConnectionError: + except requests.exceptions.ConnectionError as e: + print(e) return None return response.json() if response.headers['content-type'].startswith('application/json') else response.text