By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,668 Members | 1,377 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,668 IT Pros & Developers. It's quick & easy.

how?python urllib2 download file with auth, gui (show file %) and resume capability?

P: 1
I need a download progress window (gui) and resume capability added to it.

So far I have done this:

Expand|Select|Wrap|Line Numbers
  1. import urllib2, base64, os
  3. def dl():
  4.     dwnld=""
  5.     username="user"
  6.     password="pass"
  7.     req=urllib2.Request(dwnld)
  8.     base64str=base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
  9.     req.add_header("Authorization", "Basic %s" % base64str)   
  10.     result=urllib2.urlopen(req)
  11.     with open(os.path.basename(dwnld), "wb") as local_file:
  12.         local_file.write(
  13.         local_file.close()
  15. dl()
Help please.
Attached Files
File Type: zip (434 Bytes, 45 views)
Dec 11 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.