Imageomics / pyMorphoSource

Python package to interact with morphosource
MIT License
2 stars 0 forks source link

Download media #2

Closed johnbradley closed 1 year ago

johnbradley commented 1 year ago

Allow users to download files from morphosource.

johnbradley commented 1 year ago

The MorphoSource API has a /api/download/{media-id} endpoint that requires quite a few parameters: use statement, use category, and agreements accepted flag. This endpoint also requires a user to pass a MorphoSource API key via the request header. The endpoint returns JSON with a download_url that also requires the MorphoSource API key in the header.

johnbradley commented 1 year ago

The download_url returns a zip file with multiple files instead of just the media file. For example downloading media id 000010112 returns a zip file with the following layout: Screenshot 2023-10-17 at 8 11 34 AM

johnbradley commented 1 year ago

Some media a restricted and if approval hasn't been given the download_url will return a 404. In the JSON payload for these restricted media there is the following propery 'visibility': ['restricted_download']. I don't think there is a way to request access via the API. I think the only option is to request access via the MorphoSource website, wait for permissions (if given) and then you can download. For items that don't require asking for permission the visibility seems to be ['open'].

muratmaga commented 1 year ago

I don't think there is a way to request access via the API. I think the only option is to request access via the MorphoSource website,

Yes, this package/tool will be strictly for open-access datasets. Under their search, I believe this is indicated by the field "Publication Status" (see the screen capture).

image
johnbradley commented 1 year ago

Implemented by #5