From b2ab6f7e27f415b1390a982c4d59a468fdf99d50 Mon Sep 17 00:00:00 2001 From: zeloff Date: Tue, 16 May 2023 21:52:00 +0300 Subject: [PATCH] add get_document_with_references method --- vulners/__init__.py | 2 +- vulners/vulners.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/vulners/__init__.py b/vulners/__init__.py index d187659..f1753e5 100644 --- a/vulners/__init__.py +++ b/vulners/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -__version__ = "2.0.9" +__version__ = "2.0.10" import warnings from .vulners import VulnersApi, Vulners diff --git a/vulners/vulners.py b/vulners/vulners.py index e5ce5e6..4ece98a 100644 --- a/vulners/vulners.py +++ b/vulners/vulners.py @@ -257,6 +257,31 @@ def get_bulletin_references(self, id, fields=default_fields): """ return self.get_multiple_bulletin_references([id], fields=fields).get(id, {}) + get_multiple_documents_with_references = Endpoint( + method="post", + url="/api/v3/search/id/", + description="", + params=[ + ( + "id", + List( + item=String(), description="List of ID's. E.g., ['CVE-2017-14174']" + ), + ), + ("fields", Tuple(item=String(), default=default_fields)), + ("references", Const(True)), + ] + ) + + @validate_params(id=String(), fields=Tuple(item=String())) + def get_document_with_references(self, id, fields=default_fields): + """ + Fetch bulletin with references by identificator + + identificator: Bulletin ID. E.g., "CVE-2017-14174" + """ + return self.get_multiple_documents_with_references([id], fields=fields) + @validate_params(kbid=String()) def get_kb_seeds(self, kbid): """