fetch_video.py (417B)
1 import os 2 3 4 def main(request, response): 5 filename = os.path.join(request.doc_root, "media", "2x2-green.webm") 6 body = open(filename, "rb").read() 7 length = len(body) 8 headers = [ 9 (b"Content-Type", b"video/webm"), 10 (b"Accept-Ranges", b"bytes"), 11 (b"Content-Length", b"%d" % length), 12 (b"Content-Range", b"bytes 0-%d/%d" % (length - 1, length)), 13 ] 14 return headers, body