24
24
25
25
__all__ = ("SourceApi" ,)
26
26
27
- DEFAULT_NIST_NVD_CVES_URL = "https://services.nvd.nist.gov/rest/json/source/2.0"
27
+ DEFAULT_NIST_NVD_SOURCE_URL = (
28
+ "https://services.nvd.nist.gov/rest/json/source/2.0"
29
+ )
28
30
MAX_SOURCES_PER_PAGE = 1000
29
31
30
32
@@ -35,7 +37,7 @@ def _result_iterator(data: JSON) -> Iterator[Source]:
35
37
36
38
class SourceApi (NVDApi ):
37
39
"""
38
- API for querying the NIST NVD CVE Change History information .
40
+ API for querying the NIST NVD source API .
39
41
40
42
Should be used as an async context manager.
41
43
@@ -58,7 +60,7 @@ def __init__(
58
60
request_attempts : int = 1 ,
59
61
) -> None :
60
62
"""
61
- Create a new instance of the CVE API.
63
+ Create a new instance of the source API.
62
64
63
65
Args:
64
66
token: The API key to use. Using an API key allows to run more
@@ -73,7 +75,7 @@ def __init__(
73
75
request_attempts: The number of attempts per HTTP request. Defaults to 1.
74
76
"""
75
77
super ().__init__ (
76
- DEFAULT_NIST_NVD_CVES_URL ,
78
+ DEFAULT_NIST_NVD_SOURCE_URL ,
77
79
token = token ,
78
80
timeout = timeout ,
79
81
rate_limit = rate_limit ,
@@ -96,12 +98,14 @@ def sources(
96
98
https://nvd.nist.gov/developers/data-sources#divGetSource
97
99
98
100
Args:
99
- last_modified_start_date: Return all CVEs modified after this date.
100
- last_modified_end_date: Return all CVEs modified before this date.
101
+ last_modified_start_date: Return all sources modified after this date.
102
+ last_modified_end_date: Return all sources modified before this date.
101
103
If last_modified_start_date is set but no
102
104
last_modified_end_date is passed it is set to now.
103
- source_identifier: Return all source records where the source identifier matches
104
- start_index: Index of the first CVE to be returned. Useful only for
105
+ source_identifier: Return all source records where the source identifier matches.
106
+ request_results: Number of sources to download. Set to None
107
+ (default) to download all available CPEs.
108
+ start_index: Index of the first source to be returned. Useful only for
105
109
paginated requests that should not start at the first page.
106
110
results_per_page: Number of results in a single requests. Mostly
107
111
useful for paginated requests.
0 commit comments