CORE

NIST NVD API

class CveXplore.core.nvd_nist.nvd_nist_api.NvdNistApi(baseurl='https://services.nvd.nist.gov', api_path='2.0', proxies=None, user_agent='CveXplore')[source]

Bases: ApiBaseClass, UpdateBaseClass

__init__(baseurl='https://services.nvd.nist.gov', api_path='2.0', proxies=None, user_agent='CveXplore')[source]

The Generic api caller handles all communication towards an api resource.

__repr__()[source]

return a string representation of the obj

get_session(retries=10, backoff_factor=3, backoff_max=30, status_forcelist=(403, 429, 500, 502, 503, 504), session=None)[source]

Method for returning a session object per every requesting thread

Return type:

Session

CveXplore.core.nvd_nist.nvd_nist_api.retry_policy(info)[source]
  • It will always retry until succeeded

  • If fails for the first time, it will retry immediately,

  • If it fails again,

aioretry will perform a 100ms delay before the second retry, 200ms delay before the 3rd retry, the 4th retry immediately, 100ms delay before the 5th retry, etc… :rtype: Tuple[bool, Union[int, float]]

API Base class

class CveXplore.core.api_base_class.ApiBaseClass(baseurl, api_path=None, proxies=None, user_agent='ApiBaseClass', **kwargs)[source]

Bases: object

The GenericApi class serves as a base class for all API’s used within CveXplore

__init__(baseurl, api_path=None, proxies=None, user_agent='ApiBaseClass', **kwargs)[source]

The Generic api caller handles all communication towards an api resource.

__repr__()[source]

return a string representation of the obj

Return type:

str

call(method=None, resource=None, data=None, timeout=60, return_response_object=False)[source]

Method for requesting free format api resources

Return type:

dict

clear_headers()[source]

Method to clear the headers and the myheaders to None

del_header_field(field)[source]

Method to delete a header field

Return type:

dict

get_session(retries=1, backoff_factor=0.3, status_forcelist=(429, 500, 502, 503, 504), session=None)[source]

Method for returning a session object per every requesting thread

Return type:

Session

property headers: dict

Property to return the current headers

reset_headers()[source]

Method to reset the headers to the default values

set_header_field(field, value)[source]

Method to add a header and set it’s value

Return type:

dict