ossindex.ossindex

Module Contents

Classes

OssIndex

Attributes

logger

ossindex_lib_version

ossindex_lib_version

ossindex.ossindex.logger[source]
ossindex.ossindex.ossindex_lib_version :str = TBC[source]
ossindex.ossindex.ossindex_lib_version[source]
class ossindex.ossindex.OssIndex(*, enable_cache: bool = True, cache_location: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None)[source]
DEFAULT_CONFIG_FILE = .oss-index.config[source]
_caching_enabled :bool = False[source]
_cache_directory :str = .ossindex[source]
_cache_ttl_in_hours :int = 12[source]
_oss_index_api_version :str = v3[source]
_oss_index_host :str = https://ossindex.sonatype.org[source]
_oss_max_coordinates_per_request :int = 128[source]
_oss_index_authentication :Optional[requests.auth.HTTPBasicAuth][source]
has_ossindex_authentication() bool[source]
_attempt_config_load() None[source]
get_component_report(packages: List[packageurl.PackageURL]) List[ossindex.model.OssIndexComponent][source]
purge_local_cache() None[source]
_chunk_packages_for_oss_index(packages: List[packageurl.PackageURL]) List[List[packageurl.PackageURL]][source]

Splits up the list of packages into lists that are of a size consumable by OSS Index APIs.

Parameters

packages – List[PackageURL]

Returns

List[List[PackageURL]]

_get_api_url(api_uri: str) str[source]
_get_cached_results(packages: List[packageurl.PackageURL]) Tuple[List[packageurl.PackageURL], List[ossindex.model.OssIndexComponent]][source]
Takes a list of packages and returns two Lists:
  1. Packages without cached results

  2. Cached results for those packages where they exist

Parameters

packages – List[PackageURL]

Returns

(List[PackageURL], List[OssIndexComponent])

static _get_headers() Dict[str, str][source]
_get_results(packages: List[packageurl.PackageURL]) List[ossindex.model.OssIndexComponent][source]
_make_oss_index_component_report_call(packages: List[packageurl.PackageURL]) List[ossindex.model.OssIndexComponent][source]
_upsert_cache_with_oss_index_responses(oss_components: List[ossindex.model.OssIndexComponent]) None[source]
_get_cache_db() tinydb.TinyDB[source]
_setup_cache(cache_location: Optional[str] = None) None[source]