django - How to download the file from remote source and saving it into local folder using Python -


i need 1 help. need download file remote source , storing local folder using python. explaining code below.

def downloadfile(request):     """ function helps download file remote site"""      if request.method == 'post':         url = request.post.get('file') #i.e-http://koolfeedback.com/beta/about-us.php         filename = "status"         open(filename,'wb') fyl:             fyl.write(urllib2.urlopen(url).read())             fyl.close() 

here need download page , store local download folder using zip format.please me.

you want use urllib function urlretrieve rather urlopen, opening remote files (such text file on remote server read text from, not files want download).

see also: https://stackoverflow.com/a/22682/6328995


Comments

Popular posts from this blog

php - Embed BBCode within itself not working -

minify - Minimizing css files -

Connecting Spring Batch to Remote Cassandra Database -