tus / tus-py-client

A Python client for the tus resumable upload protocol
https://tus.io/
MIT License
169 stars 45 forks source link

Upload-Metadata not working #53

Closed duraiganesh0 closed 1 year ago

duraiganesh0 commented 2 years ago

Hi, I have been trying to send the file name and another info via the Upload-Metadata header value. But somehow i cant see it in the uploaded video in cloudflare dashboard.

Here is the cloudflare documentation https://developers.cloudflare.com/stream/uploading-videos/upload-video-file/#supported-options-in-upload-metadata

Here is my code.

        headers, cloudflare_config = self.get_headers()
        headers["Tus-Resumable"] = "1.0.0"
        headers["Upload-Length"] = "900000000"
        headers["Content-Length"] = "0"
        headers["Upload-Metadata"] = "requiresignedurls"  #trying here first
        token_url = BASE_URL + 'accounts/' + cloudflare_config['ACCOUNT_ID'] + '/stream'
        try:
            data = {
                'maxDurationSeconds': 21600,
                'requireSignedURLs': True
            }
            my_client = client.TusClient(token_url, headers=headers)
            my_client.set_headers({'Upload-Metadata': 'requiresignedurls'})  #trying here again
            my_client.metadata = {'requiresignedurls': True}  #trying here again

I have tried to send the metadata in three places in the above code. None of them are working.

Can anyone help me on this issue please?

Acconut commented 2 years ago

I haven't used Cloudflare on my own, so I cannot help you much. But from tus-py-client's point of view, this should work:

my_client.metadata = {'requiresignedurls': True}  #trying here again

Please contact Cloudflare Support if you are still having this issue.

sharif779 commented 2 years ago

Set metadata in uploader function

fs = open('/path/file')
uploader = my_client.uploader(file_stream=fs, chunk_size=200, metadata={'filename':'filename'})
Acconut commented 1 year ago

Closing this issue due to inactivity. Feel free to leave a comment if you want to continue the discussion :)