From 051909df103abfe9d48a0540880ca278035a2d55 Mon Sep 17 00:00:00 2001 From: Weston Steimel Date: Mon, 13 Nov 2023 09:57:01 +0000 Subject: [PATCH] fix: NVD api key should not be required Although providing an API key for the NVD provider is highly encouraged, it is not required and is not set in all of our environments. Signed-off-by: Weston Steimel --- src/vunnel/providers/nvd/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vunnel/providers/nvd/__init__.py b/src/vunnel/providers/nvd/__init__.py index b79f724f..76057352 100644 --- a/src/vunnel/providers/nvd/__init__.py +++ b/src/vunnel/providers/nvd/__init__.py @@ -2,7 +2,7 @@ import os from dataclasses import dataclass, field -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Optional from vunnel import provider, result, schema from vunnel.providers.nvd.manager import Manager @@ -20,10 +20,10 @@ class Config: ), ) request_timeout: int = 125 - api_key: str = "env:NVD_API_KEY" + api_key: Optional[str] = "env:NVD_API_KEY" # noqa: UP007 def __post_init__(self) -> None: - if self.api_key.startswith("env:"): + if self.api_key and self.api_key.startswith("env:"): self.api_key = os.environ.get(self.api_key[4:], "") def __str__(self) -> str: