From a34d18202e8cc069532e09eed7319758113642e0 Mon Sep 17 00:00:00 2001 From: Paul Tikken Date: Fri, 17 Nov 2023 05:28:24 +0000 Subject: [PATCH] additional error handling on nist_api --- CveXplore/VERSION | 2 +- CveXplore/api/nvd_nist/nvd_nist_api.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CveXplore/VERSION b/CveXplore/VERSION index 0010ffef..50ac5778 100644 --- a/CveXplore/VERSION +++ b/CveXplore/VERSION @@ -1 +1 @@ -0.3.14 \ No newline at end of file +0.3.15 \ No newline at end of file diff --git a/CveXplore/api/nvd_nist/nvd_nist_api.py b/CveXplore/api/nvd_nist/nvd_nist_api.py index 31f95c5b..afe5f02e 100644 --- a/CveXplore/api/nvd_nist/nvd_nist_api.py +++ b/CveXplore/api/nvd_nist/nvd_nist_api.py @@ -117,6 +117,9 @@ def _connect( raise requests.exceptions.ConnectionError(the_response) else: the_response = json.loads(r.text) + else: + the_response = r + except JSONDecodeError: if "content-type" in r.headers: if r.headers["content-type"] == "text/plain": @@ -126,6 +129,9 @@ def _connect( else: the_response = r + except Exception: + the_response = r + return the_response except requests.exceptions.ConnectionError as err: