podman-py icon indicating copy to clipboard operation
podman-py copied to clipboard

Don't try to parse the response json when not_modified

Open jarovo opened this issue 6 months ago • 2 comments

In case of not_modified (HTTP 304), there is no json in the response body. Json parsing fails like:

        if response.status_code == requests.codes.not_modified:
            if kwargs.get("ignore", False):
                return

        body = response
>       raise APIError(body["cause"], response=response, explanation=body)
E       TypeError: 'APIResponse' object is not subscriptable

.venv/lib/python3.12/site-packages/podman/domain/containers.py:477: TypeError

This patch fixes this in the way that APIError is rised with content from the text of the requests response

jarovo avatar May 18 '25 13:05 jarovo

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jarovo Once this PR has been reviewed and has the lgtm label, please assign giuseppe for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar May 18 '25 13:05 openshift-ci[bot]

/packit rebuild-failed

inknos avatar May 18 '25 21:05 inknos