Cache NVD responses with API keys
这个提交包含在:
@@ -92,8 +92,6 @@ 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
|
||||
@@ -102,7 +100,6 @@ def request_nvd_json(source: Dict[str, Any], headers: Dict[str, Any], params: Di
|
||||
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)
|
||||
return payload
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户