From 636dde4a43fcb9179a7c35fd1ac6a3825459d77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 1 Dec 2023 08:42:17 +0100 Subject: [PATCH] Change: Improve output on http errors for CVE and CPE CLI Print more information from the error response. --- pontos/nvd/cpe/__init__.py | 4 ++++ pontos/nvd/cve/__init__.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pontos/nvd/cpe/__init__.py b/pontos/nvd/cpe/__init__.py index 6a3167a9a..a1a18b471 100644 --- a/pontos/nvd/cpe/__init__.py +++ b/pontos/nvd/cpe/__init__.py @@ -19,6 +19,8 @@ from argparse import ArgumentParser, Namespace from typing import Callable +import httpx + from pontos.nvd.cpe.api import CPEApi __all__ = ("CPEApi",) @@ -77,3 +79,5 @@ def main(parser: ArgumentParser, func: Callable) -> None: asyncio.run(func(args)) except KeyboardInterrupt: pass + except httpx.HTTPStatusError as e: + print(f"HTTP Error {e.response.status_code}: {e.response.text}") diff --git a/pontos/nvd/cve/__init__.py b/pontos/nvd/cve/__init__.py index c876fe128..234badb09 100644 --- a/pontos/nvd/cve/__init__.py +++ b/pontos/nvd/cve/__init__.py @@ -19,6 +19,8 @@ from argparse import ArgumentParser, Namespace from typing import Callable +import httpx + from pontos.nvd.cve.api import CVEApi __all__ = ("CVEApi",) @@ -88,3 +90,5 @@ def main(parser: ArgumentParser, func: Callable) -> None: asyncio.run(func(args)) except KeyboardInterrupt: pass + except httpx.HTTPStatusError as e: + print(f"HTTP Error {e.response.status_code}: {e.response.text}")