diff --git a/capycli/bom/check_bom.py b/capycli/bom/check_bom.py index 3195b5ca..ba78f48b 100644 --- a/capycli/bom/check_bom.py +++ b/capycli/bom/check_bom.py @@ -66,7 +66,7 @@ def _find_by_id(self, component: Component) -> Optional[Dict[str, Any]]: print( " " + component.name + ", " + version + ", " + sw360id) - if swex.response: + if swex.response is not None: print(" Status Code: " + str(swex.response.status_code)) if swex.message: print(" Message: " + swex.message) @@ -105,7 +105,7 @@ def _find_by_name(self, component: Component) -> Optional[Dict[str, Any]]: print(Fore.LIGHTRED_EX + " Error retrieving release data: ") print( " " + component.name + ", " + version) - if swex.response: + if swex.response is not None: print(" Status Code: " + str(swex.response.status_code)) if swex.message: print(" Message: " + swex.message) diff --git a/capycli/project/create_project.py b/capycli/project/create_project.py index cff1b7f2..7920790f 100644 --- a/capycli/project/create_project.py +++ b/capycli/project/create_project.py @@ -146,12 +146,12 @@ def update_project(self, project_id: str, project: Optional[Dict[str, Any]], if swex.response.status_code == requests.codes["forbidden"]: print_red(" You are not authorized - do you have a valid write token?") sys.exit(ResultCode.RESULT_AUTH_ERROR) - if swex.response: - print_red(" " + str(swex.response.status_code) + ": " + swex.response.text) - sys.exit(ResultCode.RESULT_ERROR_ACCESSING_SW360) if swex.details: print_red(" " + swex.details.get("error", "") + ": " + swex.details.get("message", "")) sys.exit(ResultCode.RESULT_ERROR_ACCESSING_SW360) + if swex.response.text: + print_red(" " + str(swex.response.status_code) + ": " + swex.response.text) + sys.exit(ResultCode.RESULT_ERROR_ACCESSING_SW360) print_red(" Unknown error updating project: " + repr(swex)) sys.exit(ResultCode.RESULT_ERROR_ACCESSING_SW360)