I was trying to use http://www.jongsma.org/gc/scripts/ofx-ba.py to grab my bank account information from wachovia. Having no luck, I decided that I would just try to manually construct some request data using this example
So, I have this file that I want to use as the request data. Let's call it req.ofxsgml:
FXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20071015021529.000[-8:PST]
<USERID>TheNameIuseForOnlineBanking
<USERPASS>MySecretPassword
<LANGUAGE>ENG
<FI>
<ORG>Wachovia
<FID>4309
</FI>
<APPID>Money
<APPVER>1700
</SONRQ>
</SIGNONMSGSRQV1>
<BANKMSGSRQV1>
<STMTTRNRQ>
<TRNUID>438BD6F4-2106-4C88-8DE5-7625915A2FC0
<STMTRQ>
<BANKACCTFROM>
<BANKID>061000227
<ACCTID>101555555555
<ACCTTYPE>CHECKING
</BANKACCTFROM>
<INCTRAN>
<INCLUDE>Y
</INCTRAN>
</STMTRQ>
</STMTTRNRQ>
</BANKMSGSRQV1>
</OFX>
Then, in python, I try:
>>> import urllib2
>>> query = open('req.ofxsgml').read()
>>> request = urllib2.Request('https://pfmpw.wachovia.com/cgi-forte/fortecgi?servicename=ofx&amp;pagename=PFM',
query,
{ "Content-type": "application/x-ofx",
"Accept": "*/*, application/x-ofx"
})
>>> f = urllib2.urlopen(request)
This command gives me a 500 and this traceback. I wonder what is wrong with my request.
Visiting the url with no data and no concern for headers,
>>> f = urllib2.urlopen('https://pfmpw.wachovia.com/cgi-forte/fortecgi?servicename=ofx&amp;pagename=PFM')
yields the same thing as visiting that url directly,
HTTPError: HTTP Error 403: <BODY><H1>Request not allowed</H1></BODY>.
This is pretty obvious but just an observation. Everything on the subject seems to be pretty outdated. Hoping to write a simple python ofx module to open source. Maybe there is already something developed that I have not managed to find?
EDIT - If I make a flat mapping of the above information:
d = {'ACCTID': '10555555',
'ACCTTYPE': 'CHECKING',
'APPID': 'Money',
'APPVER': '1700',
'BANKID': '061000227',
'DTCLIENT': '20071015021529.000[-8:PST]',
'FID': '4309',
'INCLUDE': 'Y',
'LANGUAGE': 'ENG',
'ORG': 'Wachovia',
'TRNUID': 'I18BD6F4-2006-4C88-8DE5-7625915A2FC0',
'USERID': 'm48m40',
'USERPASS': '12397'}
and then urlencode it and make the request with that as the data
query=urllib.urlencode(d)
request = urllib2.Request('https://pfmpw.wachovia.com/cgi-forte/fortecgi?servicename=ofx&amp;pagename=PFM',
query,
{ "Content-type": "application/x-ofx",
"Accept": "*/*, application/x-ofx"
})
f = urllib2.urlopen(request)
HTTP Error 403: <BODY><H1>Request not allowed</H1></BODY>