How to use the ofxtools.QifParser function in ofxtools

To help you get started, we’ve selected a few ofxtools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wesabe / fixofx / lib / ofxtools / qif_converter.py View on Github external
# showing current balance, but not as a balance -- instead as a
        # transaction before the type header.  And, there are a bunch of other
        # cases where crap before the type header is messing us up right now.
        # So, this is an awfully big hammer but one that at least lets people
        # import from other finance programs and broken banks.
        straycrap = re.search("^(.*?)!Type", self.qif, re.DOTALL | re.IGNORECASE | re.MULTILINE)
        if straycrap is not None:
            crap = straycrap.group(1)
            if len(crap) > 0:
              if self.debug:
                  sys.stderr.write("Discarding stray crap from beginning of QIF file:\n%s" % crap)
              self.qif = self.qif.replace(crap, '', 1)

        if self.debug: sys.stderr.write("Parsing document.\n")

        parser = ofxtools.QifParser(debug=debug)
        self.parsed_qif = parser.parse(self.qif)

        if self.debug: sys.stderr.write("Cleaning transactions.\n")

        # We do a two-pass conversion in order to check the dates of all
        # transactions in the statement, and convert all the dates using
        # the same date format.  The first pass does nothing but look
        # at dates; the second actually applies the date conversion and
        # all other conversions, and extracts information needed for
        # the final output (like date range).
        txn_list = self._extract_txn_list(self.parsed_qif)
        self._guess_formats(txn_list)
        self._clean_txn_list(txn_list)

ofxtools

Library for working with Open Financial Exchange (OFX) data

GPL-3.0
Latest version published 3 years ago

Package Health Score

58 / 100
Full package analysis

Similar packages