Hi there,
I’m trying to automatize the process of uploading a video which is automatically being updated (which works fine). I am using Xibo 1.8.12 as Docker installation on Debian 9.5. I copied the Python code from Postman for POST /library
and adjusted it. When I run the script I get sometimes this error ('{"files":[{"name":"1551261397-1028","size":550,"type":"application\\/x-www-form-urlencoded","error":"Filetype not allowed"}]}'
) and sometimes this error ('{"files":[{"name":"1.mp4","size":0,"type":"video\\/mp4","error":"File is too small"}]}'
). The auth_token fetching (getAccessToken()
) works fine, too. My code is:
def postNewVideo():
payload = "------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"files\"; filename=\"1.mp4\"\nContent-Type: video/mp4\n\n\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"name\"\n\n1\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"oldMediaId\"\n\n74\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"updateInLayouts\"\n\n1\n------WebKitFormBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"deleteOldRevisions\"\n\n1\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"
headers = {
"content-type": "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Bearer " + getAccessToken(),
"cache-control": "no-cache"
}
response = requests.post("http://ip.add.re.ss/api/library", data=payload, headers=headers)
return response.text
I hope you can help me.