Skip to main content

Simple Python library to use the SCANOSS APIs.

Project description

SCANOSS Python Package

The SCANOSS python package provides a simple easy to consume library for interacting with SCANOSS APIs/Engine.

Installation

To install (from pypi.org), please run:

pip3 install scanoss

Usage

The package can be run from the command line, or consumed from another Python script.

CLI Usage

The Python package manager (pip), will register the following command during installation:

scanoss-py

It is also possible to launch it using:

python3 -m scanoss.cli

Running the bare command will list the available sub-commands:

> scanoss-py

usage: scanoss-py [-h] {version,ver,scan,sc,fingerprint,fp,wfp} ...

SCANOSS Python CLI. Ver: 0.2.0, License: GPL 2.0-or-later

optional arguments:
  -h, --help            show this help message and exit

Sub Commands:
  valid subcommands

  {version,ver,scan,sc,fingerprint,fp,wfp}
                        sub-command help
    version (ver)       SCANOSS version
    scan (sc)           Scan source code
    fingerprint (fp, wfp)
                        Fingerprint source code

From there it is possible to scan a source code folder:

> scanoss-py scan -o scan-output.json <source-folder>

Package Usage

The scanoss package can also be used in other Python projects/scripts. A good example of how to consume it can be found here.

In general the easiest way to consume it is to import the required module as follows:

from scanoss.scanner import Scanner

def main():
    scanner = Scanner()
    scanner.scan_folder( '.' )
    
if __name__ == "__main__":
    main()

Scanning URL and API Key

By Default, scanoss uses the API URL endpoint for SCANOSS OSS KB: https://osskb.or/api/scan/direct. This API does not require an API key.

These values can be changed from the command line using:

> scanoss-py scan --apiurl <URL> --key <KEY>

From code it would look like this:

from scanoss.scanner import Scanner

def main():
    scanner = Scanner(url='new-url', api_key='key')
    scanner.scan_folder( '.' )
    
if __name__ == "__main__":
    main()

Requirements

Python 3.6 or higher.

Source code

The source for this package can be found here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scanoss-0.5.3.tar.gz (22.8 kB view hashes)

Uploaded Source

Built Distribution

scanoss-0.5.3-py3-none-any.whl (25.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page