From baf8e8fa64a6960e3964e2450cba3913c77886f5 Mon Sep 17 00:00:00 2001 From: hao Date: Wed, 18 Mar 2026 19:39:47 -0700 Subject: [PATCH] Cache NVD responses with API keys --- scripts/intel/sources/nvd_api.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/intel/sources/nvd_api.py b/scripts/intel/sources/nvd_api.py index bea3bee1..b3d02cd4 100644 --- a/scripts/intel/sources/nvd_api.py +++ b/scripts/intel/sources/nvd_api.py @@ -92,18 +92,15 @@ def _write_cached_payload(params: Dict[str, Any], payload: Dict[str, Any]) -> No def request_nvd_json(source: Dict[str, Any], headers: Dict[str, Any], params: Dict[str, Any]) -> Dict[str, Any]: - api_key = os.environ.get("NVD_API_KEY") - if not api_key: - cached = _load_cached_payload(params) - if cached is not None: - return cached + cached = _load_cached_payload(params) + if cached is not None: + return cached response = request_nvd(source, headers, params) response.raise_for_status() payload = response.json() if not isinstance(payload, dict): raise ValueError("NVD response payload was not an object") - if not api_key: - _write_cached_payload(params, payload) + _write_cached_payload(params, payload) return payload