Get video id for cloudflare stream with python


#1

Hey, I am using python tus client to upload the files but I would like to retrieve the video id so I can check the progress within my script. I understand how to do this in a bash script but I want to include it in my python app

from tusclient import client

zone_id = "xxxxx"
api_key = "xxxxx"
chunk_sz = 5242880
email = "xxxxx"
file_name = "sample.mp4"
api_url = f"https://api.cloudflare.com/client/v4/zones/{zone_id}/media"

my_client = client.TusClient(api_url,headers={'X-Auth-Key': api_key,'X-Auth-Email':email})

uploader = my_client.uploader(file_name, chunk_size=chunk_sz)

uploader.upload()

#2

Although this thread is a bit old - I just came across the same issue. For reference, I think the URL of your video is the same as the tus upload ID. Using the python tus library, this is:

uploader.url

You can use this as the endpoint to query for encoding progress etc.