Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

# SW360 Base Library for Python

## V1.8.1

* `delete_project` now works properly. Before it could have happened the you get a `JSONDecodeError`.
All delete methods have been checked and made more resilient.
* dependency updates.

## V1.8.0

* Update `get_all_releases` to include `isNewClearingWithSourceAvailable` parameter:
Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
# SPDX-FileCopyrightText: (c) 2019-2024 Siemens
# SPDX-FileCopyrightText: (c) 2019-2025 Siemens
# SPDX-License-Identifier: MIT
-->

Expand Down Expand Up @@ -100,7 +100,7 @@ of a given project on SW360. This requires colorama>=0.4.1.

## License

Copyright 2019-2024 Siemens
Copyright 2019-2025 Siemens

The project is licensed under the MIT license.
SPDX-License-Identifier: MIT
Expand Down
545 changes: 201 additions & 344 deletions SBOM/sbom.cdx.json

Large diffs are not rendered by default.

457 changes: 232 additions & 225 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SPDX-FileCopyrightText: (c) 2018-2024 Siemens
# SPDX-FileCopyrightText: (c) 2018-2025 Siemens
# SPDX-License-Identifier: MIT

[tool.poetry]
name = "sw360"
version = "1.8.0"
version = "1.8.1"
description = "Python interface to the SW360 software component catalogue"
authors = ["Thomas Graf <thomas.graf@siemens.com>",
"Gernot Hillier <gernot.hillier@siemens.com>"]
Expand Down Expand Up @@ -73,3 +73,4 @@ no_implicit_reexport = true

[tool.codespell]
skip = "test_all_components.json,test_all_releases.json,./htmlcov/*,./__internal__/*,./docs/_static/*,./docs/searchindex.js,./docs/objects.inv"
ignore-words-list = "visbility"
4 changes: 2 additions & 2 deletions sw360/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# -------------------------------------------------------------------------------
# Copyright (c) 2019-2024 Siemens
# Copyright (c) 2019-2025 Siemens
# All Rights Reserved.
# Author: thomas.graf@siemens.com
#
# Licensed under the MIT license.
# SPDX-License-Identifier: MIT
# -------------------------------------------------------------------------------

__version__ = (1, 8, 0)
__version__ = (1, 8, 1)

from .sw360_api import SW360
from .sw360error import SW360Error
Expand Down
5 changes: 3 additions & 2 deletions sw360/components.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -------------------------------------------------------------------------------
# Copyright (c) 2019-2024 Siemens
# Copyright (c) 2019-2025 Siemens
# Copyright (c) 2022 BMW CarIT GmbH
# All Rights Reserved.
# Authors: thomas.graf@siemens.com, gernot.hillier@siemens.com
Expand Down Expand Up @@ -313,7 +313,8 @@ def delete_component(self, component_id: str) -> Optional[Dict[str, Any]]:
response = self.api_delete(url)
if response is not None:
if response.ok:
return response.json()
if response.text:
return response.json()
return None

def get_users_of_component(self, component_id: str) -> Optional[Dict[str, Any]]:
Expand Down
4 changes: 3 additions & 1 deletion sw360/license.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -------------------------------------------------------------------------------
# Copyright (c) 2019-2022 Siemens
# Copyright (c) 2019-2025 Siemens
# Copyright (c) 2022 BMW CarIT GmbH
# All Rights Reserved.
# Authors: thomas.graf@siemens.com, gernot.hillier@siemens.com
Expand Down Expand Up @@ -68,6 +68,8 @@ def delete_license(self, license_shortname: str) -> Optional[bool]:
:raises SW360Error: if there is a negative HTTP response
"""

# 2025-01-23: returns 500 - internal server error

if not license_shortname:
raise SW360Error(message="No license shortname provided!")

Expand Down
3 changes: 2 additions & 1 deletion sw360/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ def delete_project(self, project_id: str) -> Optional[Dict[str, Any]]:
response = self.api_delete(url)
if response is not None:
if response.ok:
return response.json()
if response.text:
return response.json()
return None

def get_users_of_project(self, project_id: str) -> Optional[Dict[str, Any]]:
Expand Down
5 changes: 3 additions & 2 deletions sw360/releases.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -------------------------------------------------------------------------------
# Copyright (c) 2019-2024 Siemens
# Copyright (c) 2019-2025 Siemens
# Copyright (c) 2022 BMW CarIT GmbH
# All Rights Reserved.
# Authors: thomas.graf@siemens.com, gernot.hillier@siemens.com
Expand Down Expand Up @@ -239,7 +239,8 @@ def delete_release(self, release_id: str) -> Optional[Dict[str, Any]]:
response = self.api_delete(url)
if response is not None:
if response.ok:
return response.json()
if response.text:
return response.json()
return None

def get_users_of_release(self, release_id: str) -> Optional[Dict[str, Any]]:
Expand Down
12 changes: 7 additions & 5 deletions sw360/vendor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -------------------------------------------------------------------------------
# Copyright (c) 2019-2023 Siemens
# Copyright (c) 2019-2025 Siemens
# Copyright (c) 2022 BMW CarIT GmbH
# All Rights Reserved.
# Authors: thomas.graf@siemens.com, gernot.hillier@siemens.com
Expand Down Expand Up @@ -83,7 +83,7 @@ def update_vendor(self, vendor: Dict[str, Any], vendor_id: str) -> Optional[Dict
url = self.url + "resource/api/vendors/" + vendor_id
return self.api_patch(url, json=vendor)

def delete_vendor(self, vendor_id: str) -> Dict[str, Any]:
def delete_vendor(self, vendor_id: str) -> Optional[Dict[str, Any]]:
"""Delete an existing vendor

API endpoint: DELETE /vendors
Expand All @@ -93,7 +93,7 @@ def delete_vendor(self, vendor_id: str) -> Dict[str, Any]:
:raises SW360Error: if there is a negative HTTP response
"""

# 2019-04-03: error 405 - not allowed
# 2019-04-03/2025-01-23: error 405 - not allowed

if not vendor_id:
raise SW360Error(message="No vendor id provided!")
Expand All @@ -103,5 +103,7 @@ def delete_vendor(self, vendor_id: str) -> Dict[str, Any]:
response = self.api_delete(url)
if response is not None:
if response.ok:
return response.json()
raise SW360Error(response, url)
if response.text:
return response.json()

return None
4 changes: 2 additions & 2 deletions tests/test_sw360_components.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -------------------------------------------------------------------------------
# Copyright (c) 2020-2024 Siemens
# Copyright (c) 2020-2025 Siemens
# All Rights Reserved.
# Author: thomas.graf@siemens.com
#
Expand Down Expand Up @@ -767,7 +767,7 @@ def test_delete_component(self) -> None:
responses.add(
responses.DELETE,
url=self.MYURL + "resource/api/components/123",
body="4",
body='{\n "resourceId" : "468abcd6e7f849199d9323c9a16b2776",\n "status" : 200\n}',
status=200,
)

Expand Down
15 changes: 14 additions & 1 deletion tests/test_sw360_projects.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -------------------------------------------------------------------------------
# Copyright (c) 2019-2024 Siemens
# Copyright (c) 2019-2025 Siemens
# All Rights Reserved.
# Author: thomas.graf@siemens.com
#
Expand Down Expand Up @@ -1118,6 +1118,19 @@ def test_delete_project(self) -> None:

lib.delete_project("123")

@responses.activate
def test_delete_project_empty_response(self) -> None:
lib = self.get_logged_in_lib()

responses.add(
responses.DELETE,
url=self.MYURL + "resource/api/projects/123",
body="",
status=200,
)

lib.delete_project("123")

@responses.activate
def test_delete_project_no_id(self) -> None:
lib = self.get_logged_in_lib()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sw360_releases.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -------------------------------------------------------------------------------
# Copyright (c) 2023-2024 Siemens
# Copyright (c) 2023-2025 Siemens
# All Rights Reserved.
# Author: thomas.graf@siemens.com
#
Expand Down Expand Up @@ -530,7 +530,7 @@ def test_delete_release(self) -> None:
responses.add(
responses.DELETE,
url=self.MYURL + "resource/api/releases/123",
body="4",
body='{\n "resourceId" : "8ddc6d15e0c4424ea756b8e0b77ad1e9",\n "status" : 200\n}',
status=200,
)

Expand Down
Loading