diff --git a/pyvulnerabilitylookup/api.py b/pyvulnerabilitylookup/api.py index ab7e00f..2897865 100644 --- a/pyvulnerabilitylookup/api.py +++ b/pyvulnerabilitylookup/api.py @@ -204,7 +204,7 @@ def get_vendor_product_vulnerabilities(self, vendor: str, product: str, return r.json() def get_vendor_product_vulnerabilities_iter(self, vendor: str, product: str, - *, since: date | datetime) -> Generator[dict[str, Any]]: + *, since: date | datetime | None=None) -> Generator[dict[str, Any]]: '''Iterate over the vulnerabilities per vendor and a specific product :param vendor: A vendor owning products (must be in the known vendor list) @@ -215,12 +215,14 @@ def get_vendor_product_vulnerabilities_iter(self, vendor: str, product: str, per_page = 10 while True: r = self.get_vendor_product_vulnerabilities(vendor, product, since=since, page=page, per_page=per_page) - # The format i the response is a dict with the source as key, + # The format in the response is a dict with the source as key, # that contains a list [[ID, vulnerability], ...] - # we yield that last part + # we yield that last part appended with the source as a third element. if not any(r.values()): break - for vulnerabilities in r.values(): + for origin, vulnerabilities in r.items(): + for vulnerability in vulnerabilities: + vulnerability.append(origin) yield from vulnerabilities page += 1