Steve & all interested parties, Thanks for this script, I believe it will prove useful to many.
This ties into a project/feature that many want, but no one has taken up as the lead contact for. In "The State of the GnuCash Project", item 2.1.2.4 is "Implement GnuCash as a helper to a Web Browser" and the discription outlines the idea of using GC to download OFX/QIF files from websites into GC. It seems that this work, with that of Benoit's LibOFX and a couple others who have sent in similar things, could result in this feature being available in GC. What we need now is a team that will volunteer to work on this and for one of them to act as the project contact. Any takers on the project contact position? and volunteers? Please respond to the list, and I will be recording names, email, ICQ name, and skills (as outlined in the Introduction of "State of GC..."). Thanks, John R. ----- Original message ----- From: "Steve Dunham" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED], [EMAIL PROTECTED] Date: Tue, 03 Feb 2004 09:19:28 -0800 Subject: python script for OFX Statement Download There seem to be other people looking at this stuff, so I thought I'd post what I have so far. Brief version: Attached is a python script that downloads OFX transactions from ameritrade, discover, and AT&T universal card. > I've read a couple places that you aren't sure where to get the > information necessary to support statement downloads into GnuCash - > most notably the actual bank URLs. It turns out it's actually pretty > easy to obtain a complete list of banks, capabilities and their URLs > from Microsoft Money. Yup, I've done the same thing. I found that fipartner.ini in the mode0.cab distributed with the money2004 demo contains, for each institution, a url to a file on Microsoft's web site. This file contains a unicode XML config file for that institution, including the OFX URL, the FID, and the name of the institution. (Also data on the capabilities of the server.) The ofx spec tells the format of the messages. They are SGML messages posted to the server with a header at the front. (XML is specified in the newer spec, but none of the servers I've worked with have support for it.) The mime type of the post MUST be application/x-ofx. (Some servers, e.g. ameritrade, will fail if you don't set this.) After trying and failing with a hand-crafted XML request based on the latest standard, I decided that working out the details would require too much trial and error with the actual servers. So I took the short cut approach and ran the MS Money demo against a debug version of wininet.dll. (So I could capture the contents of the https transactions.) The net result of all of this is a little python script that can download the OFX for the last month's transactions or a list of accounts. It doesn't try to parse the responses, it only writes them to a file. I currently use it with ameritrade, ATT Universal Card, and Discover card. For Discover, this is the only way I can find to get my transactions in ofx format, because there is no download option on the web site. I use this script fairly regularly in conjunction with gnucash. The script is a quick hack, and I'm still learning python (the reason I used python instead of perl), but hopefully it's a useful example to someone. Aside from the structure on the top, you probably want to read it backwards, as it builds from little functions to big ones. Also, change the "if 1" to "if 0" to print the queries instead of sending them. Steve [EMAIL PROTECTED] _______________________________________________ gnucash-devel mailing list [EMAIL PROTECTED] http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel
