I'd like to create an http response with an mp4 video as the content
Following the advice I found here this is what I have so far:
resp = Response()
resp.status_code = 200
with open("unit_tests/unit_test_data/testvid 2 - public_2.mp4", "rb") as vid:
resp._content = vid.read(1024 * 1024)
resp.headers = {"content-length": "13837851"}
This response is then to be used as follows :
with open(fname, "wb") as file:
for data in resp.iter_content(chunk_size=1024):
size = file.write(data)
However in the second part, when trying to read the content of my response I get the following error:
AttributeError: 'NoneType' object has no attribute 'read'
Any help is welcome, thanks!