pontos.nvd package¶
Submodules¶
- pontos.nvd.convert_camel_case(dct)¶
Convert camel case keys into snake case keys
- pontos.nvd.format_date(date)¶
Format date matching to NVD api
- class pontos.nvd.NVDApi(url, *, token=None, timeout=Timeout(timeout=180.0), rate_limit=True)¶
Abstract base class for querying the NIST NVD API.
Should be used as an async context manager.
Create a new instance of the CVE API.
- Parameters:
url (str) – The API URL to use.
token (str | None) – The API key to use. Using an API key allows to run more requests at the same time.
timeout (Timeout | None) – Timeout settings for the HTTP requests
rate_limit (bool) – Set to False to ignore rate limits. The public rate limit (without an API key) is 5 requests in a rolling 30 second window. The rate limit with an API key is 50 requests in a rolling 30 second window. See https://nvd.nist.gov/developers/start-here#divRateLimits Default: True.
- class pontos.nvd.NVDResults(api, params, result_func, *, request_results=None, results_per_page=None, start_index=0)¶
A generic object for accessing the results of a NVD API response
It implements the pagination and will issue requests against the NVD API.
- async chunks()¶
Return the results in chunks
The size of the chunks is defined by results_per_page.
Examples
nvd_results: NVDResults = ... async for results in nvd_results.chunks(): for result in results: print(result)
- Return type:
- async items()¶
Return the results of the NVD API response
Examples
nvd_results: NVDResults = ... async for result in nvd_results.items(): print(result)
- Return type: