sw360 / sw360python

Python library for SW360 REST API access
Other
4 stars 7 forks source link

download_xxx_attachment ignores HTTP status #20

Closed gernot-h closed 1 year ago

gernot-h commented 1 year ago

If you try to download a non-existing attachment, we today create a file with the JSON error messages as we ignore the HTTP status.

> sw360.download_release_attachment("test.txt", "111","222")
> cat test.txt
{"timestamp":"2023-07-30T19:42:21.815136Z","status":404,"error":"Not Found","message":"Release does not exists! id=111"}

Instead, it should raise SW360Error as for any other failed operation, e.g.

> sw360.get_attachment("222")
---------------------------------------------------------------------------
SW360Error                                Traceback (most recent call last)
[...]
SW360Error: <Response [404]>