saketkc / pysradb

Package for fetching metadata and downloading data from SRA/ENA/GEO
https://saketkc.github.io/pysradb
BSD 3-Clause "New" or "Revised" License
303 stars 49 forks source link

[ENH] geo_download_links error handling #216

Open alexhermida opened 3 months ago

alexhermida commented 3 months ago

Is your feature request related to a problem? Please describe.

Currently the geo_download_links function is not accurate on the responses as it's raising KeyError for IDs that don't exit but also for IDs which do exist but they don't have supplementary files attached.

So this test and error raised is not accurate and could lead to a misunderstanding.

Describe the solution you'd like

I think the error should be different for IDs that doesn't exists and IDs that do exist and don't have downloadable links.

But first refactor could be just failing first checking if the response is a 404 (instead down in the code) and raising the specific error "No downloadable links available for the following GEO id" or something similar. Next step would be to effectively check if the GEO id exists or not if that useful here.

Happy to make a contribution and open a PR if you think this is useful.

Thanks for all the work on the library.

Best.

saketkc commented 3 months ago

Good point. We should handle this. PRs are always welcome!