def authorize_basic(user=None, password=None, realm=None, uri=None):
''' Call before calling download '''
if user and password and realm and uri:
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password(realm=realm, uri=uri, user=user, passwd=password)
opener = urllib2.build_opener(auth_handler)
urllib2.install_opener(opener)
评论列表
文章目录