pycontribs / pyrax

The Python SDK for the Rackspace Cloud
developer.rackspace.com
Apache License 2.0
237 stars 208 forks source link

Set metadata for multiple objects? #609

Open kirkre opened 8 years ago

kirkre commented 8 years ago

Is there a method to set the metadata for multiple objects at once? Being able to add a metadata pair for every object in a folder would be ideal. I need to add an Access-Control-Allow-Origin header for HLS video files, with thousands of files in a folder.

Thanks,

Kirk

kirkre commented 8 years ago

On cloud files that is, which you can guess but I should have mentioned.

briancurtin commented 8 years ago

There is nothing like this available in Pyrax.

kirkre commented 8 years ago

Thanks Brian. After trying set_object_metadata using a for loop to do an entire 1500 file folder, I don't think a function that does a whole folder at once would help either way. Purging the files is difficult, and I find the X-Object-Meta- prefix added by this function prevents CORS headers from being recognized in browsers. I found a discussion from two years ago where people reported this prefix did work with CORS headers, but not for me in any browser. Perhaps the browsers have changed criteria?

Setting the metadata on object creation works much better. Upload_file does not add a prefix to the metadata so the CORS headers do work, and no need to purge. Now I can't help wondering, do the functions sync_folder_to_container and/or upload_folder support adding headers on object creation? If I remember right those functions are much faster than uploading file by file, and it could be simpler to use than a for loop.

Thanks,

Kirk