import urllib2, base64, os
def dl():
dwnld="http://xxx.xxx.xxx.xxx:xx/user/file.zip"
username="user"
password="pass"
req=urllib2.Request(dwnld)
base64str=base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
req.add_header("Authorization", "Basic %s" % base64str)
result=urllib2.urlopen(req)
with open(os.path.basename(dwnld), "wb") as local_file:
local_file.write(result.read())
local_file.close()
dl()
现在我需要一个下载进度窗口(gui)并添加恢复功能。求助。