Skip to content

Commit

Permalink
Change: Fix docstrings / variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
n-thumann authored and greenbonebot committed Mar 6, 2025
1 parent 4b8a3e5 commit 1f718d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions pontos/nvd/source/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

__all__ = ("SourceApi",)

DEFAULT_NIST_NVD_CVES_URL = "https://services.nvd.nist.gov/rest/json/source/2.0"
DEFAULT_NIST_NVD_SOURCE_URL = (
"https://services.nvd.nist.gov/rest/json/source/2.0"
)
MAX_SOURCES_PER_PAGE = 1000


Expand All @@ -35,7 +37,7 @@ def _result_iterator(data: JSON) -> Iterator[Source]:

class SourceApi(NVDApi):
"""
API for querying the NIST NVD CVE Change History information.
API for querying the NIST NVD source API.
Should be used as an async context manager.
Expand All @@ -58,7 +60,7 @@ def __init__(
request_attempts: int = 1,
) -> None:
"""
Create a new instance of the CVE API.
Create a new instance of the source API.
Args:
token: The API key to use. Using an API key allows to run more
Expand All @@ -73,7 +75,7 @@ def __init__(
request_attempts: The number of attempts per HTTP request. Defaults to 1.
"""
super().__init__(
DEFAULT_NIST_NVD_CVES_URL,
DEFAULT_NIST_NVD_SOURCE_URL,
token=token,
timeout=timeout,
rate_limit=rate_limit,
Expand All @@ -96,12 +98,14 @@ def sources(
https://nvd.nist.gov/developers/data-sources#divGetSource
Args:
last_modified_start_date: Return all CVEs modified after this date.
last_modified_end_date: Return all CVEs modified before this date.
last_modified_start_date: Return all sources modified after this date.
last_modified_end_date: Return all sources modified before this date.
If last_modified_start_date is set but no
last_modified_end_date is passed it is set to now.
source_identifier: Return all source records where the source identifier matches
start_index: Index of the first CVE to be returned. Useful only for
source_identifier: Return all source records where the source identifier matches.
request_results: Number of sources to download. Set to None
(default) to download all available CPEs.
start_index: Index of the first source to be returned. Useful only for
paginated requests that should not start at the first page.
results_per_page: Number of results in a single requests. Mostly
useful for paginated requests.
Expand Down
2 changes: 1 addition & 1 deletion tests/nvd/source/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async def test_sources(self):
with self.assertRaises(StopAsyncIteration):
await anext(it)

async def test_cve_changes_change_dates(self):
async def test_sources_change_dates(self):
self.http_client.get.side_effect = create_source_responses()

it = aiter(
Expand Down

0 comments on commit 1f718d8

Please sign in to comment.