#NEWLINE# @ VariableHandler ( 'http_basic_auth' ) #NEWLINE# def basic_auth( rq , **values ) : #NEWLINE# #INDENT# username = values . get ( 'username' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'value' , '' ) #NEWLINE# password = values . get ( 'password' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'value' , '' ) #NEWLINE# authinfo = b64encode ( '{}:{}' . format ( username , password ) . encode ( 'utf-8' ) ) #NEWLINE# authinfo = 'Basic {}' . format ( authinfo . decode ( 'utf-8' ) ) #NEWLINE# rq . set_headers ( Authorization = authinfo )