bioblend icon indicating copy to clipboard operation
bioblend copied to clipboard

`show_matching_datasets` function restricts access for public histories

Open mtekman opened this issue 3 years ago • 3 comments

Accessing datasets in a public history (that does not belong to me) is restricted in an inconsistent way.

When I try to match datasets using the show_matching_datasets function, it throws me a 403 error.

MWE:

from bioblend import galaxy

gi = galaxy.GalaxyInstance(url="https://usegalaxy.eu", key=<api-key>)
dc = galaxy.datasets.DatasetClient(gi)
hc = galaxy.histories.HistoryClient(gi)

name_filter="illumina.*"
##public_url="https://usegalaxy.eu/u/sars-cov2-bot/h/2020-09-28-update"
## I found the below ID in the page source of the above url
public_hid = "c36be749fd002b4d"

hc.show_matching_datasets(public_hid, name_filter=name_filter)

it waits for about minute, and then gives out:

403 error  "HistoryDatasetAssociation  is not accessible by user"

however I can still iterate over the history and access the datasets (albeit much more slowly)

from bioblend import galaxy

gi = galaxy.GalaxyInstance(url="https://usegalaxy.eu", key=<api-key>)
dc = galaxy.datasets.DatasetClient(gi)
hc = galaxy.histories.HistoryClient(gi)

name_filter="illumina.*"
public_hid = "c36be749fd002b4d"

tmp = hc.show_history(public_hid)
set_ids = tmp['state_ids']['ok']
for set in set_ids:
     print(dc.show_dataset(se)['name'])

mtekman avatar Oct 08 '20 14:10 mtekman