how to send file via http with python

Posted by ep45 on Stack Overflow See other posts from Stack Overflow or by ep45
Published on 2010-03-25T09:14:52Z Indexed on 2010/03/25 9:43 UTC
Read the original article Hit count: 425

Filed under:
|
|

Hello, I have a problem.

I use Apache with mod_wsgi and webpy, and when i send a file on http, a lot packets are lost.

This is my code :

web.header('Content-Type','video/x-flv')
web.header('Content-length',sizeFile)
f = file(FILE_PATH, 'rb')
    while True:
        buffer = f.read(4*1024)
        if buffer :
            yield buffer
        else :
            break
f.close()

What in my code is wrong ?

thanks.

© Stack Overflow or respective owner

Related posts about python

Related posts about webpy