{"id":22281037,"url":"https://github.com/blackducksoftware/hub-rest-api-python","last_synced_at":"2025-05-14T17:09:19.353Z","repository":{"id":33235997,"uuid":"140323504","full_name":"blackducksoftware/hub-rest-api-python","owner":"blackducksoftware","description":"HUB REST API Python bindings","archived":false,"fork":false,"pushed_at":"2025-02-18T22:01:01.000Z","size":1188,"stargazers_count":93,"open_issues_count":25,"forks_count":110,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-05-07T06:51:44.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blackducksoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-09T18:01:23.000Z","updated_at":"2025-04-01T14:11:48.000Z","dependencies_parsed_at":"2023-10-13T17:14:48.806Z","dependency_job_id":"aaa6e85c-40ae-4863-a2c5-64f304ec0df1","html_url":"https://github.com/blackducksoftware/hub-rest-api-python","commit_stats":{"total_commits":542,"total_committers":54,"mean_commits":"10.037037037037036","dds":0.6863468634686347,"last_synced_commit":"0c0dcf7b1d75fa4b32e5fdad3687d1fb567502f2"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackducksoftware%2Fhub-rest-api-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackducksoftware%2Fhub-rest-api-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackducksoftware%2Fhub-rest-api-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackducksoftware%2Fhub-rest-api-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blackducksoftware","download_url":"https://codeload.github.com/blackducksoftware/hub-rest-api-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254190396,"owners_count":22029632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T16:12:57.485Z","updated_at":"2025-05-14T17:09:19.322Z","avatar_url":"https://github.com/blackducksoftware.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\nThe hub-rest-api-python provides Python bindings for Hub REST API.\n\n# Paging and Black Duck v2022.2\n\nIn v2022.2 of Black Duck the REST API introduced a max page size to protect system resource usage. See the Black Duck [release notes on Synopsys Community](https://community.synopsys.com/s/article/Black-Duck-Release-Notes) for the details of which API endpoints are affected. Users of the the python bindings here should leverage the Client interface which provides automatic paging support to make best use of these endpoints.\n\n**The old HubInstance interface and many of the examples using it do not perform paging and will break as a result of the changes in v2022.2**.\n\nAny issues related to the HubInstance Interface will be closed as *Won't Fix*\n\nAny PRs with new or modified example scripts/utilities **must** use the client interface.\n\n# New in 1.0.0\n\nIntroducing the new Client class.\n\nIn order to provide a more robust long-term connection, faster performance, and an overall better experience a new\nClient class has been designed.\n\nIt is backed by a [Requests session](https://docs.python-requests.org/en/master/user/advanced/#session-objects) object. The user specifies a base URL, timeout, retries, proxies, and TLS verification upon initialization and these attributes are persisted across all requests.\n\nAt the REST API level, the Client class provides a consistent way to discover and traverse public resources, uses a\n[generator](https://wiki.python.org/moin/Generators) to fetch all items using pagination, and automatically renews the bearer token.\n\nSee [Client versus HubInstance Comparison](https://github.com/blackducksoftware/hub-rest-api-python/wiki/Client-versus-HubInstance-Comparison) and also read the [Client User Guide](https://github.com/blackducksoftware/hub-rest-api-python/wiki/Client-User-Guide) on the [Hub REST API Python Wiki](https://github.com/blackducksoftware/hub-rest-api-python/wiki).\n\n### Important Notes\nThe old HubInstance (in HubRestApi.py) keeps its existing functionality for backwards compatibility and therefore does **not** currently leverage any of the new features in the Client class.\n\nWe believe that the new features are compelling enough to strongly encourage users to consider moving from HubInstance to Client.\nSee [Client versus HubInstance Comparison](https://github.com/blackducksoftware/hub-rest-api-python/wiki/Client-versus-HubInstance-Comparison).\n\n\nPlease give it a try and let us know what you think!\n\n# To use\n\n```\npip3 install blackduck\n```\n\n```python\nfrom blackduck import Client\nimport logging\nimport os\n\nlogging.basicConfig(\n    level=logging.INFO,\n    format=\"[%(asctime)s] {%(module)s:%(lineno)d} %(levelname)s - %(message)s\"\n)\n\nbd = Client(\n    token=os.environ.get('blackduck_token'),\n    base_url=\"https://your.blackduck.url\",\n    # verify=False  # TLS certificate verification\n)\n\nfor project in bd.get_resource(name='projects'):\n    print(project.get('name'))\n```\n\n### Examples\n\nExample code showing how to work with the new Client can be found in the *examples/client* folder.\n\n**Examples which use the old HubInstance interface -which is not maintained- are not guaranteed to work. Use at your own risk.**\n\n# Version History\n\nIncluding a version history on a go-forward basis. \n\n## v1.1.0\n\nRetries will be attempted for all HTTP verbs, not just GET.\n\n# Test #\n\nUsing [pytest](https://pytest.readthedocs.io/en/latest/contents.html)\n\n```bash\ngit clone https://github.com/blackducksoftware/hub-rest-api-python.git\ncd hub-rest-api-python\n# optional but advisable: create/use virtualenv\n# you should have 3.x+, e.g. Python 3.8.0+\n\npip3 install -r requirements.txt\npip3 install .\ncd test\npytest\n```\n\n## Install package locally\n\nDo this when testing a new version.\n\n```\ngit clone https://github.com/blackducksoftware/hub-rest-api-python.git\ncd hub-rest-api-python\npip3 install -r requirements.txt\npip3 install .\n```\n\nTo uninstall:\n\n```\npip3 uninstall blackduck\n```\n\n## Where can I get the latest release? ##\nThis package is available on PyPi:\n\n`pip3 install blackduck`\n\n## Documentation ##\nDocumentation for hub-rest-api-python can be found on the base project:\n[Hub REST API Python Wiki](https://github.com/blackducksoftware/hub-rest-api-python/wiki)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackducksoftware%2Fhub-rest-api-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackducksoftware%2Fhub-rest-api-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackducksoftware%2Fhub-rest-api-python/lists"}