def __init__(self): """ Constructor in charge of connecting to mailbox via IMAPS. """ Parser.__init__(self) self._imap = imaplib.IMAP4_SSL(settings.SCORING_EMAIL['host']) self._imap.login(settings.SCORING_EMAIL['polling']['user'], settings.SCORING_EMAIL['polling']['password']) self._imap.select('INBOX') self._failed_uids = [] self._parser = None self._current = 0 self._feed_queue(True)
def __init__(self, input_file, delimiter): """ Default constructor :param str input: Path of the CSV file to parse :param str delimiter: CSV delimiter :raises: `IOError` if an error occurs while opening the file """ Parser.__init__(self) if not os.path.exists(input_file): raise IOError(str('File [{}] does not exist.'.format(input_file))) self._delim = delimiter self._current_row = 0 with open(input_file, 'r') as fdesc: content = fdesc.read() self._rows = csv.reader(content.splitlines(), delimiter=delimiter)
def __init__(self, input_file, delimiter): """ Default constructor :param str input: Path of the CSV file to parse :param str delimiter: CSV delimiter :raises: `IOError` if an error occurs while opening the file """ Parser.__init__(self) if not os.path.exists(input_file): raise IOError(str('File [%s] does not exist.' % (input_file))) self._delim = delimiter self._current_row = 0 with open(input_file, 'r') as fdesc: content = fdesc.read() self._rows = csv.reader(content.splitlines(), delimiter=delimiter)