blackducksoftware / hub-rest-api-python

HUB REST API Python bindings
Apache License 2.0
89 stars 104 forks source link

New version of BlackDuckHub breaks this feature: 2022.7 targeted release #217

Closed AmeliaDollars closed 1 year ago

AmeliaDollars commented 2 years ago

Description

The search components endpoint is being deprecated in the 2022.7 update per release notes for 2022.4. This update removes the search/component endpoint and replaces it with "search/kb-components" (which is not yet officially supported). This issue is to update the headers used for the component search functionality to enable use of the new endpoint.

https://github.com/blackducksoftware/hub-rest-api-python/blob/da81b322b31af2ca106c838529131030bb713d4a/blackduck/Components.py#L43

https://github.com/blackducksoftware/hub-rest-api-python/blob/da81b322b31af2ca106c838529131030bb713d4a/blackduck/Core.py#L76

divinvishnu commented 2 years ago

Any update on this request?

OffBy0x01 commented 2 years ago

I would suggest moving to the client interface rather than relying on updates to the old interface.

Fixes for the old interface are unlikely to be a priority given other aspects (unlimited page size) are already broken by the 2022.4 release.

AmeliaDollars commented 2 years ago

I would suggest moving to the client interface rather than relying on updates to the old interface.

Fixes for the old interface are unlikely to be a priority given other aspects (unlimited page size) are already broken by the 2022.4 release.

This is also broken in the Client as it includes the same headers: https://github.com/blackducksoftware/hub-rest-api-python/blob/baaa427907046a2051191e91101fe114236363ee/blackduck/Client.py#L62

OffBy0x01 commented 2 years ago

I would suggest moving to the client interface rather than relying on updates to the old interface. Fixes for the old interface are unlikely to be a priority given other aspects (unlimited page size) are already broken by the 2022.4 release.

This is also broken in the Client as it includes the same headers:

https://github.com/blackducksoftware/hub-rest-api-python/blob/baaa427907046a2051191e91101fe114236363ee/blackduck/Client.py#L62

As we state in the documentation, Client will passthrough kwargs to the underlying session.request, meaning you could do something like this:

bd = blackduck.Client(...)
for component in bd.get_resource("components", params={'q': 'myComponentName'}, headers={'Accept':'application/vnd.myDataType'}):
  print(component)

More examples in the examples :) https://github.com/blackducksoftware/hub-rest-api-python/blob/master/examples/client/generate_notices_report_for_project_version.py#L70