'How to upload large video file to DooStream

I try to upload a large video file to DoodStream but using Python and requests.

My code:

from requests_toolbelt import MultipartEncoder
import requests
import json

api_key="83898e7z7wd2f0nv0jb60"

filename=('1.mp4')


url=('https://doodapi.com/api/upload/server?key='+api_key)
r=requests.get(url).text
y = json.loads(r)
upload_url= (y["result"])
url=(upload_url+'?'+api_key)
m = MultipartEncoder(
    fields={'api_key': api_key,
            'file': ('filename', open('D:\Project\AutoSiteNga\FC2-PPV-2539191\[email protected]', 'rb'), 'video/mp4')}
    )

r = requests.post(url,data=m,
                   headers={'Content-Type': m.content_type})
print(r.text)`

After running my code, I get an error: {"status":403, "msg":"not a video file"}.

DooStream API Document: https://doodstream.com/api-docs#upload Thanks !



Solution 1:[1]

Try this:

m = MultipartEncoder(
    fields={'api_key': api_key,
            'file': (filename, open('D:\Project\AutoSiteNga\FC2-PPV-2539191\[email protected]', 'rb'), 'video/mp4')}
    )

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RiveN