Hide dataset download problem

Hi!When I use api to run, I want to ignore the download of hide datasets. What should I do?Here is part of my code:
def download_history_output(gi: “GalaxyInstance”, history_id: str, output_dir: str):
history_details = gi.histories.show_history(history_id)
for dataset_id in history_details[“state_ids”][“ok”]:
dataset_details = gi.datasets.show_dataset(dataset_id)
if not dataset_details[“visible”]:
continue
gi.datasets.download_dataset(dataset_id, file_path=output_dir, use_default_filename=True)