Downloading and Sending the file to the client's browser

Νίκος Βέργος me.on.nzt at gmail.com
Thu Feb 2 18:42:36 EST 2017


==========================================
# Give user the file requested
url = "http://superhost.gr/data/files/%s" % realfile
response = requests.get( url, stream=True )

with open( realfile, 'wb' ) as f:
f.write( response.content )
==========================================

The above code will download and save the specific file locally to the server where the python script is running.

What alternation does this need to be able to send it to the client's browser?



More information about the Python-list mailing list