Skip to main content

Default Behaviour

By default, the Scanner class connects to the SCANOSS OSS Knowledge Base API (OSSKB API) at https://api.osskb.org without requiring authentication.

Using an API Key

To authenticate with a SCANOSS API key, pass it as the api_key argument to the Scanner constructor. You can obtain an API key from your SCANOSS account dashboard.
from scanoss.scanner import Scanner
from scanoss.scanoss_settings import ScanossSettings

def main():
    scanner = Scanner(
        api_key='your_api_key',
        scanoss_settings=ScanossSettings(),
    )
    scanner.scan_folder_with_options('/path/to/project')

if __name__ == "__main__":
    main()
Note: ScanossSettings() is required by the Scanner constructor and holds the scan configuration. See ScanossSettings for available options.

Using a Custom API Endpoint

To direct the SDK to a different API endpoint, pass the url argument:
from scanoss.scanner import Scanner
from scanoss.scanoss_settings import ScanossSettings

def main():
    scanner = Scanner(
        url='https://your-custom-api-url',
        scanoss_settings=ScanossSettings(),
    )
    scanner.scan_folder_with_options('/path/to/project')

if __name__ == "__main__":
    main()

Using an API Key with a Custom Endpoint

Both arguments can be combined:
from scanoss.scanner import Scanner
from scanoss.scanoss_settings import ScanossSettings

def main():
    scanner = Scanner(
        url='https://your-custom-api-url',
        api_key='your_api_key',
        scanoss_settings=ScanossSettings(),
    )
    scanner.scan_folder_with_options('/path/to/project')

if __name__ == "__main__":
    main()