There is a problem with the results after downloading the workflow using api

Hi!I used the api document of bioblend. After running the workflow, I want to download my output data set, but there is an error. How can I modify it? Here is part of my code:
invocation = gi.workflows.invoke_workflow(workflow_id, inputs=inputs, inputs_by=“name”, history_id=history_id)

def get_status(gi: "GalaxyInstance", history_id: str) -> Dict[str, Any]:
    history = gi.histories.show_history(history_id)
    state: Dict[str, Any] = {
        "state": history["state"],
    }

    if history.get("state_details") is not None:
        state["state_details"] = history["state_details"]
        total_complete = sum(history["state_details"].values())
        if total_complete > 0:
            state["percent_complete"] = 100 * history["state_details"]["ok"] / total_complete
        else:
            state["percent_complete"] = 0
    return state

while True:
    status = get_status(gi, history_id)
    if status["state"] == "ok":
        break
    time.sleep(10)
outputs = gi.histories.show_history(history_id, contents=True)
for output in outputs:
    if output["history_content_type"] == "dataset":
        output_id = output["id"]
        output_name = output["name"]
        output_file_path = os.path.join(output_dir, output_name)
        gi.datasets.download_dataset(output_id, file_path=output_file_path, use_default_filename=False)

I hope to receive an answer.

Consolidating into I made an error when I used bioblend's api to download the output