MT940 format parser
Asked Answered
A

2

5

Can you recommend any OS, ready-to-go, well-documented and not dead MT940 format parser for Python?

Aseity answered 30/9, 2010 at 13:54 Comment(0)
A
4

I only manage to find this python project: https://github.com/headcr4sh/django-banking Maybe you can extend/update the above project for your own purpose. The code is quite easy to read.

If you don't mind using Java, there's one up to date project that could parse/create any swift message easily:

http://sourceforge.net/projects/wife/

Code sample:

creation: https://github.com/prowide/prowide-core-examples/blob/master/src/com/prowidesoftware/swift/samples/MessageCreationExample.java

parsing: https://github.com/prowide/prowide-core-examples/blob/master/src/com/prowidesoftware/swift/samples/ParseMT940Example.java

their website: http://www.prowidesoftware.com/core.jsp

Adnopoz answered 23/7, 2014 at 13:37 Comment(0)
M
7

Possibly a little late to the party, but I've written a library to support MT940 with Python some time ago. I've just given it a large update to be a bit more versatile so it should do the trick for most people: https://github.com/WoLpH/mt940

If there are any problems, please let me know. Pull requests are always welcome :)

Currently it supports reading any Mt940 file I could find (I have a testset of 31 files) and depending on the format it will parse more or less information.

To add specific support for your files there is pre- and post-processor support to add some custom parsing: http://mt940.readthedocs.org/en/latest/mt940.html#mt940.models.Transactions Some banks have extra information in the transaction details which is easily supportable using this method.

Documentation can be found on readthedocs: http://mt940.readthedocs.org/en/latest/mt940.html

The package is installable through Pypi: https://pypi.python.org/pypi/mt-940

pip install mt-940

Example usage:

import mt940
import pprint

transactions = mt940.parse('tests/jejik/abnamro.sta')

print 'Transactions:'
print transactions
pprint.pprint(transactions.data)

print
for transaction in transactions:
    print 'Transaction: ', transaction
    pprint.pprint(transaction.data)
Melindamelinde answered 22/5, 2015 at 11:57 Comment(0)
A
4

I only manage to find this python project: https://github.com/headcr4sh/django-banking Maybe you can extend/update the above project for your own purpose. The code is quite easy to read.

If you don't mind using Java, there's one up to date project that could parse/create any swift message easily:

http://sourceforge.net/projects/wife/

Code sample:

creation: https://github.com/prowide/prowide-core-examples/blob/master/src/com/prowidesoftware/swift/samples/MessageCreationExample.java

parsing: https://github.com/prowide/prowide-core-examples/blob/master/src/com/prowidesoftware/swift/samples/ParseMT940Example.java

their website: http://www.prowidesoftware.com/core.jsp

Adnopoz answered 23/7, 2014 at 13:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.