Skip to main content

Package for using the Synopsys Black Duck Hub REST API.

Project description

Overview

The hub-rest-api-python provides Python bindings for Hub REST API.

:warning:Recently CVE-2020- 27589, a medium severity security defect, was discovered in the blackduck PyPi library which affects versions 0.0.25 – 0.0.52 that could suppress certificate validation if the calling code used either the upload_scan or download_project_scans methods. These methods did not enforce certificate validation. Other methods in the library are not affected. The defect was fixed in version 0.0.53.

Customers using the blackduck library should upgrade to version 0.0.53, or later, to implement the fix.

To use

pip install blackduck
from blackduck.HubRestApi import HubInstance
import json

username = "sysadmin"
password = "your-password"
urlbase = "https://ec2-34-201-23-208.compute-1.amazonaws.com"

hub = HubInstance(urlbase, username, password, insecure=True)

projects = hub.get_projects()

print(json.dumps(projects.get('items', [])))

Examples

Example code showing how to do various things can be found in the examples folder.

Build

You should be using virtualenv, virtrualenvwrapper to make things easy on yourself.

Ref: Packaging Python Projects Tutorial

Build the blackduck packages

To build both the source distribution package and the wheel package,

pip3 install -r requirements.txt
python3 setup.py sdist bdist_wheel

Distribute the package

Requires you have an account on either/both PyPi and Test PyPi AND you must be a package maintainer.

Send a request to gsnyder@synopsys.com or gsnyder2007@gmail.com if you want to be listed as a package maintainer.

To PyPi

Upload to PyPi,

twine upload dist/*

Then try installing it from PyPy

pip install blackduck

To Test PyPi

Upload to Test PyPi,

twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Then try installing it from Test PyPy

pip install --index-url https://test.pypi.org/simple/ blackduck

Install package locally

Do this when testing a new version.

git clone https://github.com/blackducksoftware/hub-rest-api-python.git
cd hub-rest-api-python
pip3 install -r requirements.txt
pip3 install .

Test

Using (pytest)[https://pytest.readthedocs.io/en/latest/contents.html]

git clone https://github.com/blackducksoftware/hub-rest-api-python.git
cd hub-rest-api-python
# optional but advisable: create/use virtualenv
# you should have 3.x+, e.g. Python 3.7.0

pip3 install -r requirements.txt
pip3 install .
cd test
pytest

Where can I get the latest release?

This package is available on PyPi,

pip3 install blackduck

Documentation

Documentation for hub-rest-api-python can be found on the base project: Hub REST API Python Wiki

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

blackduck-0.0.56.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

blackduck-0.0.56-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file blackduck-0.0.56.tar.gz.

File metadata

  • Download URL: blackduck-0.0.56.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for blackduck-0.0.56.tar.gz
Algorithm Hash digest
SHA256 2874e616b0651b240b49a2964ac8847e644d3b93ab1522412b2e84776c8f3b17
MD5 f5bb15936979666ea2c22a4eed4b22d5
BLAKE2b-256 18def8d1c2534ce61d5e2cdd40986534977cf5dbe52c25177ccaf995b90f4ebf

See more details on using hashes here.

File details

Details for the file blackduck-0.0.56-py3-none-any.whl.

File metadata

  • Download URL: blackduck-0.0.56-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for blackduck-0.0.56-py3-none-any.whl
Algorithm Hash digest
SHA256 e44acdbd2ef2b94b0263b91f51b646f3cd8f091d1b22c49100769648ead058a9
MD5 e9682859d7acb12b041fc4e8e8584ba3
BLAKE2b-256 5bf67216e149df996cca6466a5a91f936a2ca6e50f104c1243c11583f51d98eb

See more details on using hashes here.

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