#NEWLINE# def retry_http_basic_auth( self , host , req , realm ) : #NEWLINE# #INDENT# ( user , pw ) = self . passwd . find_user_password ( realm , host ) #NEWLINE# if ( pw is not None ) : #NEWLINE# #INDENT# raw = ( '%s:%s' % ( user , pw ) ) #NEWLINE# auth = ( 'Basic %s' % base64 . encodestring ( raw ) . strip ( ) ) #NEWLINE# if ( req . headers . get ( self . auth_header , None ) == auth ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# newreq = copy . copy ( req ) #NEWLINE# newreq . add_header ( self . auth_header , auth ) #NEWLINE# newreq . visit = False #NEWLINE# return self . parent . open ( newreq ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None