feat: Support image uploading via EOS
here's the version to test:
pip install git+ssh://git@gitlab.cern.ch:7999/atlas-itk/sw/db/itkdb.git@feat/imageUploading
to compare how this works, take a call that you've done in the past with a text file, and with an image file
import itkdb
c = itkdb.Client()
data = dict(component='...', title='...', description='...', type='file', url='...')
files = {'data': (filename, open(file, 'rb'), file_type)}
c.post('createComponentAttachment', data=data, files=files)
and just add one more thing (use_eos=True
to tell the Client to bypass some uploads to eos)
import itkdb
c = itkdb.Client(use_eos=True)
data = dict(component='...', title='...', description='...', type='file', url='...')
files = {'data': (filename, open(file, 'rb'), file_type)}
c.post('createComponentAttachment', data=data, files=files)
There will be some info printed out (I will move these to debug statements soon). This should return output like:
{
"dateTime": "2022-03-19T04:53:47.959Z",
"title": "...",
"description": "...",
"filesize": xyz,
"userIdentity": "XX-YYYY-Z",
"type": "eos",
"code": "...",
"contentType": null,
"filename": "...",
"url": "https://eosatlas.cern.ch/eos/atlas/test/itkpd/...",
"token": "..."
}
Note that right now - large non-image files will not go to EOS. This only bypasses to EOS for image files. (Try it out with use_eos=True
for an image attachment and a non-image attachment and see the differences.)
Edited by Giordon Holtsberg Stark
Merge request reports
Activity
Please register or sign in to reply