blackducksoftware / hub-rest-api-python

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

Fix CookieAuth and strengthen BearerAuth error handling #155

Closed skiyooka closed 3 years ago

skiyooka commented 3 years ago

Incorporate stronger error handling from PR #139

@gsnyder2007 and @AR-Calder: Glenn said that he would like to discourage username/password authentication. It can be still done via the following code:

from blackduck.Client import HubSession from blackduck.Authentication import CookieAuth

verify = False # server's TLS certificate base_url = "https://my.blackduck.url" session = HubSession(base_url, timeout=15.0, retries=3, verify=verify) auth = CookieAuth(session, username="sysadmin", password="PASSWORD")

hub = Client(base_url=base_url, session=session, auth=auth, verify=verify)

I'll add the above as an example when I work on the documentation shortly. If you want to have username and password as arguments to Client and just print out a warning, I can easily make it that way. Let me know.