(self)
Get the password from file or prompt for it.
Get the password from file or prompt for it.
Get the password from file or prompt for it .
def _do_get_password(self):
        """Get the password from file or prompt for it."""
        if (self.savepw is False and
                os.path.exists(self.passwdfilename) is True):
            try:
                sec = secrets.SecretIsbg(filename=self.passwdfilename,
                                         imapset=self.imapsets)
                self.imapsets.passwd = sec.get("password")
                del sec
                self.logger.debug("Successfully read password file")
            except Exception:  # pylint: disable=broad-except
                self.logger.exception('Error reading pw!')

        # do we have to prompt?
        if self.imapsets.passwd is None:
            if not self.interactive:
                raise ISBGError(__exitcodes__['ok'],
                                "You need to specify your imap password " +
                                "and save it with the --savepw switch")
            self.imapsets.passwd = getpass.getpass(
                "IMAP password for %s@%s: " % (
                    self.imapsets.user, self.imapsets.host))
def _do_get_password ( self ) : if ( self . savepw is False and os . path . exists ( self . passwdfilename ) is True ) : try : sec = secrets . SecretIsbg ( filename = self . passwdfilename , imapset = self . imapsets ) self . imapsets . passwd = sec . get ( "password" ) del sec self . logger . debug ( "Successfully read password file" ) except Exception : # pylint: disable=broad-except self . logger . exception ( 'Error reading pw!' ) # do we have to prompt? if self . imapsets . passwd is None : if not self . interactive : raise ISBGError ( __exitcodes__ [ 'ok' ] , "You need to specify your imap password " + "and save it with the --savepw switch" ) self . imapsets . passwd = getpass . getpass ( "IMAP password for %s@%s: " % ( self . imapsets . user , self . imapsets . host ) )