#NEWLINE# def fetch( url , data = None , username = None , password = None , headers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , method = None ) : #NEWLINE# #INDENT# request = Request ( url , data = data , headers = headers ) #NEWLINE# if method : #NEWLINE# #INDENT# request . get_method = ( lambda : method ) #NEWLINE# #UNINDENT# if ( username and password ) : #NEWLINE# #INDENT# request . add_header ( 'Authorization' , ( 'Basic ' + b64encode ( ( '%s:%s' % ( username , password ) ) ) . strip ( ) ) ) #NEWLINE# #UNINDENT# return urlopen ( request )