MT940格式解析器

发布于 2024-09-25 17:17:18 字数 58 浏览 6 评论 0 原文

您能否推荐任何适用于 Python 的操作系统、现成的、文档齐全且尚未失效的 MT940 格式解析器?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故人的歌 2024-10-02 17:17:18

可能有点晚了,但我不久前已经用 Python 编写了一个支持 MT940 的库。我刚刚对其进行了一次大更新,使其更加通用,因此它应该适合大多数人:https: //github.com/WoLpH/mt940

如果有任何问题,请告诉我。 Pull 请求总是受欢迎的:)

目前它支持读取我能找到的任何 Mt940 文件(我有 31 个文件的测试集),并且根据格式,它将解析或多或少的信息。

要为您的文件添加特定支持,可以使用预处理器和后处理器支持来添加一些自定义解析:http://mt940.readthedocs.org/en/latest/mt940.html#mt940.models.Transactions
一些银行在交易详细信息中包含额外信息,使用此方法可以轻松支持这些信息。

文档可以在 readthedocs 上找到: http://mt940.readthedocs.org/en/latest/ mt940.html

该软件包可通过 Pypi 安装:https://pypi.python.org /pypi/mt-940

pip install mt-940

用法示例:

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)

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)
三人与歌 2024-10-02 17:17:18

我只设法找到这个python项目: https://github.com/headcr4sh/django-banking
也许您可以出于自己的目的扩展/更新上述项目。该代码非常容易阅读。

如果您不介意使用 Java,有一个最新项目可以轻松解析/创建任何 swift 消息:

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

代码示例:

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

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

他们的网站:http://www.prowidesoftware.com/core.jsp

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文