captin411 / ofxclient Goto Github PK
View Code? Open in Web Editor NEWBank transaction downloader and python OFX client libraries
License: MIT License
Bank transaction downloader and python OFX client libraries
License: MIT License
https://pypi.python.org/packages/source/o/ofxclient/ofxclient-1.3.8.tar.gz does not contain the license text.
This isn't the fault of ofxclient, but I'm posting here for reference, because I haven't seen this mentioned elsewhere online.
Recently OFX downloads stopped working for my Capital One 360 and Capital One Spark Business accounts. The last time I know for sure it worked is October 15th, though it possibly worked as late as November 10th. I now get this error:
OSError: [Errno 113] No route to host
I tried on two different ISPs with the same result, and I also tried running ofxclient over Tor, but got the same error.
This is a (sanitized) version of my ofxclient.ini
:
[b811...]
account_type = SAVINGS
description = Assets:Savings
institution.broker_id =
institution.client_args.app_id = QWIN
institution.client_args.app_version = 2500
institution.client_args.id = c0b3...
institution.client_args.ofx_version = 102
institution.description = Capital One 360
institution.id = 031176110
institution.local_id = 2f20...
institution.org = ING DIRECT
institution.password = [snip]
institution.url = https://ofx.capitalone360.com/OFX/ofx.html
institution.username = [snip]
local_id = b811...
number = [snip]
routing_number = 031176110
The domain ofx.capitalone360.com
apparently points to ofx-prod.aws-rb.capitaloneglsbex.com
, which currently resolves to an IP of 199.15.190.151. Both of the ISPs that I have tried can't seem to figure out how to get packets to that domain, so I suspect it isn't being used anymore and someone forgot to update the DNS.
I also see that the OFX Home page for Capital One 360 shows the last sucessful validation was November 24th, which lines up with the dates I mentioned.
I called customer service at Capital One, and while they were able to help me find the new way to get to the page to create the access code used for the password above (again for reference: go to the account details page, click on Account Services & Settings at top right, at the top of the middle column, under Settings & Preferences, click Privacy, then finally click the Access Code tab), but they weren't able to shed any light on that domain name. They claimed there haven't been any changes to this service, FWIW. The call ended with them telling me to contact the app provider, which obviously isn't a solution because it isn't the app that has changed, but something the app connects to.
So AFAICT, there are two options:
Capital One is correct, and there have been no changes to the Financial Management Tools / OFX Direct Connect service. If that is the case, then the only cause I could see would be a routing error between here and Capital One. Aside from the fact that all other Capital One services I have used work fine, all my testing indicates it isn't a local issue. I could maybe blame caching, but it's been happening for long enough now that this seems unlikely.
Capital One is incorrect, and there was some change to the service, intentional or not.
A. Possible intentional changes:
B. Possible unintentional changes:
I lean towards the most likely option being that the service was moved to a new domain and there was internal miscommunication about this fact.
Regardless, I'm posting this here for the reference of myself and others. If you have any other information or can disprove any of these scenarios, feel free to comment. In particular, please mention whether or not your ISP can route to that domain. It it possible that domain has ICMP disabled, so I'm particularly interested in whether ofxclient can connect, not just whether a ping or traceroute fails.
For completeness: you can still get the transactions, but you have to download them by hand. From the account page, click Account Services & Settings, then Download Transactions under Account Management in the left column. Then you can select the time frame and the file format to download. Despite accessing them through account page, they will be combined for all accounts, as indicated on the download page.
This library has been a fantastic help, thanks a lot for this.
I'm having trouble running this from cron though, as from cron dbus is not available. I've tried sourcing the DBUS_SESSION_BUS_ADDRESS variable in my cron job but that is a bit of a hack.
Do you know any way around this or use a different scheduling system?
The exception I get when DBUS is not available is when the password is accessed
File "/usr/local/lib/python2.7/dist-packages/ofxclient-1.3.8-py2.7.egg/ofxclient/client.py", line 202, in _field
return "<"+tag+">"+value
TypeError: cannot concatenate 'str' and 'NoneType' objects
Thanks,
Mike
I'm on Debian Stable. Installed latest by cloning directly from git. Everything seemed to go fine, until I tried to add my bank:
$ ofxclient
+----------------------------------
Main
Edit /home/trs80/ofxclient.ini to
change descriptions or ofx options
+----------------------------------
(A) Add an account
(Q) Quit
choice> a
+----------------------------------
Add account
+----------------------------------
------
Notice
------
You are about to search for bank connection information
on a third party website. This means you are trusting
http://ofxhome.com and their security policies.
You will be sending your bank name to this website.
------
bank name eg. "express" (enter to exit)> My Bank
(0) My Bank
(1) My Bank Alternate Name
choice> 0
Traceback (most recent call last):
File "/usr/local/bin/ofxclient", line 11, in <module>
load_entry_point('ofxclient==2.0.4', 'console_scripts', 'ofxclient')()
File "/usr/local/lib/python3.5/dist-packages/ofxclient-2.0.4-py3.5.egg/ofxclient/cli.py", line 63, in run
main_menu(args)
File "/usr/local/lib/python3.5/dist-packages/ofxclient-2.0.4-py3.5.egg/ofxclient/cli.py", line 83, in main_menu
add_account_menu(args)
File "/usr/local/lib/python3.5/dist-packages/ofxclient-2.0.4-py3.5.egg/ofxclient/cli.py", line 129, in add_account_menu
bank = OFXHome.lookup(found[int(choice)]['id'])
File "/usr/local/lib/python3.5/dist-packages/ofxhome-0.3.3-py3.5.egg/ofxhome/__init__.py", line 29, in lookup
File "/usr/local/lib/python3.5/dist-packages/ofxhome-0.3.3-py3.5.egg/ofxhome/__init__.py", line 129, in __init__
File "/usr/lib/python3.5/_strptime.py", line 510, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
File "/usr/lib/python3.5/_strptime.py", line 343, in _strptime
(data_string, format))
ValueError: time data '' does not match format '%Y-%m-%d %H:%M:%S'
Is it possible to write the ofxclient.ini to a sqlite db?
Thanks,
Andrew
When I try to connect to Chase via ofxclient in cmdline, I get the following:
`Microsoft Windows [Version 10.0.17134.472]
(c) 2018 Microsoft Corporation. All rights reserved.
You are about to search for bank connection information
on a third party website. This means you are trusting
http://ofxhome.com and their security policies.
username> my_username
password>
authentication failed: Please verify your identity within the next 7 days. Using your desktop computer, go to your banks website and visit the Secure Message Center for instructions.`
When I check my secure message center, nothing is there. I found another entry on Github that said to edit the ofxclient.ini file and change institution.client_args.ofx_version = 102
in your Chase config to institution.client_args.ofx_version = 103
. But my ofxclient.ini file is completely blank when I open it in notepad. Anyone have any suggestions?
Also, does Chase require you to pay to be able to download your transaction history using ofxclient?
Line 125 in 4da2719
The default for the date parameter causes TD Bank to return "Client is up to date". If that parameter is set to '19700101' it returns the account list successfully.
How is a user supposed to set that parameter though? After instantiating Institution()
here...
inst = Institution(
id='1002',
org='CommerceBank',
url='https://ofx.tdbank.com/eftxweb/td.ofx',
username=tdbank.username,
password=tdbank.password,
client_args={
'ofx_version': '103',
'app_version': '2200',
'id': tdbank.clientid,
}
)
...calling inst.accounts()
should just work, but for TD Bank it doesn't.
ofxclient/ofxclient/institution.py
Line 134 in 4da2719
institution.accounts()
doesn't take any parameters, so there's no way to override the default date parameter. Wouldn't it make sense to have that method accept **kwargs
and pass them on to account_list_query()
?
I will provide a PR to do just that. Afterwards, this call should work fine:
inst.accounts(date='19700101')
Trying to connect to a Wells Fargo account.
Getting the following response:
<OFX>
<SIGNONMSGSRSV1><SONRS>
<STATUS>
<CODE>2000
<SEVERITY>ERROR
<MESSAGE>The financial management software you are using is no longer supported. Please upgrade your software or contact us at 1-800-956-4442 for assistance. (2000:9)
</STATUS>
<DTSERVER>20170208195142.478[0:GMT]
<LANGUAGE>ENG
<FI>
<ORG>WF
<FID>3000
</FI>
</SONRS>
</SIGNONMSGSRSV1>
</OFX>
File "/base/data/home/apps/s~eeqjdev/dev.366103472990174732/eeqj/geckoboard.py", line 2, in <module>
import ofxclient
File "/base/data/home/apps/s~eeqjdev/dev.366103472990174732/thirdparty/ofxclient/__init__.py", line 4, in <module>
from config import OfxConfig
File "/base/data/home/apps/s~eeqjdev/dev.366103472990174732/thirdparty/ofxclient/config.py", line 11, in <module>
DEFAULT_CONFIG = os.path.expanduser('~/ofxclient.ini')
File "/python27_runtime/python27_dist/lib/python2.7/posixpath.py", line 259, in expanduser
import pwd
ImportError: No module named pwd```
Basically, trying to use the password database module (pwd) on non-unix will fail, or, in my case, on Google App Engine. It's not safe to assume that os.path.expanduser() is safe to use for portability
It stops ofxclient from installing on python 3.4 because BS 4 is a different package than the earlier BS versions.
Also, it should not be necessary - the ofxparse dependency should already take care of it.
Passwords are written to logs as part of the dump of the OFX request. I'd like them either removed, obscured or maybe some way to optionally remove or filter them out. Not sure what the best solution is - ideas?
When trying to download from Chase with the following config:
[f0a14074d33cdf83b4a099bc322dbe2fe19680ca1719425b33de5022]
account_type = CHECKING
description = Checking
institution.broker_id =
institution.client_args.app_id = QWIN
institution.client_args.app_version = 2200
institution.client_args.id = 4fa6f700154f49543b869492f99c883f
institution.client_args.ofx_version = 103
institution.description = Chase
institution.id = 10898
institution.local_id = e51fb78f88580a1c2e3bb65bd59495384383e58abda8796c9bf06dcf
institution.org = B1
institution.password =
institution.url = https://ofx.chase.com
institution.username =
local_id = f0a14074d33cdf83b4a099bc322dbe2fe19680ca1719425b33de5022
number = XXXXXXXXX
routing_number = XXXXXXXXX
After sending the request(It prints out in verbose mode), I receive this:
Traceback (most recent call last):
File "/usr/local/bin/ofxclient", line 11, in <module>
sys.exit(run())
File "/usr/local/lib/python3.5/site-packages/ofxclient/cli.py", line 52, in run
main_menu()
File "/usr/local/lib/python3.5/site-packages/ofxclient/cli.py", line 87, in main_menu
view_account_menu(account)
File "/usr/local/lib/python3.5/site-packages/ofxclient/cli.py", line 160, in view_account_menu
out = account.download(days=DOWNLOAD_DAYS)
File "/usr/local/lib/python3.5/site-packages/ofxclient/account.py", line 102, in download
response = self.institution.client().post(query)
File "/usr/local/lib/python3.5/site-packages/ofxclient/client.py", line 110, in post
response = res.read().decode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0x92 in position 337: ordinal not in range(128)```
It looks like the master branch has a few bugfixes that haven't been released since the 2.0.3 version from Apr 28, 2017. When you get a chance, would you be willing to cut a new release?
I get this error (tried a couple of times to make sure it wasn't me putting in my password wrong).
authentication failed: 'NoneType' object has no attribute 'find'
I am suddenly getting the following message.
<MESSAGE>We are unable to process your request at this time. Please try again later or contact us at XXX-XXX-XXXX.
I contacted the number that it mentioned and was told that the former "Direct Connect" service is no longer available. They said that in order to increase their security, the could only enable Quicken and Quickbooks directly!!!!!
I'm not sure if a work around is even possible.
Hello,
Thanks for such a great program. I'm trying to add my Discover Card to the ofxclient list, but it appears to not be working. I search for 'Discover', select 'Discover Card', and then enter my user name and password. There are no errors given about any sort of authentication failure or anything, but just returns to the main menu (with no additional account added). If I enter a bogus password, it tells me the authentication has failed, so I assume it is successfully logging in somehow, but just not adding any accounts.
Looking at ofxclient.ini
, nothing is added to the file when adding the account, even if I remove the initial ofxclient.ini
file that was there before.
Is there anyway to go about debugging this? Looking at www.ofxhome.com, it doesn't seem like people have had any real problems lately with Discover Card...
Thanks,
Josh
For me at least, Citi Credit Cards stopped working again on July 22 (5 days ago).
I actually called Citi and asked and was referred to their Online Technical Support at 1-866-544-5534. I called them and was told (not sure how much I believe this) that it's a known issue with problems downloading transactions, they're working on it, and to use PDF instead. I explained that you can't import a PDF into finance software, and was told they have people working on it and to call back in 24 hours if it's not fixed.
The error I'm seeing is coming from Akamai, their CDN provider, so there's definitely either something broken, they shut Direct Connect off alltogether, or they're using Akamai to filter on user-agent or other headers or part of the OFX itself.
Here's the debug-level logging for what I'm seeing, with all sensitive information replaced with the string "REDACTED":
2018-07-27 17:39:59,999 [DEBUG client.py:154 - root._do_post() ] posting data to https://www.accountonline.com/cards/svc/CitiOfxManager.do
2018-07-27 17:40:00,005 [DEBUG client.py:174 - root._do_post() ] ---- request headers ----
2018-07-27 17:40:00,005 [DEBUG client.py:176 - root._do_post() ] Content-Type: application/x-ofx
2018-07-27 17:40:00,005 [DEBUG client.py:176 - root._do_post() ] Host: www.accountonline.com
2018-07-27 17:40:00,005 [DEBUG client.py:176 - root._do_post() ] Content-Length: 660
2018-07-27 17:40:00,005 [DEBUG client.py:176 - root._do_post() ] Connection: Keep-Alive
2018-07-27 17:40:00,006 [DEBUG client.py:176 - root._do_post() ] Accept: */*, application/x-ofx
2018-07-27 17:40:00,006 [DEBUG client.py:176 - root._do_post() ] User-Agent: httpclient
2018-07-27 17:40:00,006 [DEBUG client.py:178 - root._do_post() ] ---- request body (query) ----
2018-07-27 17:40:00,006 [DEBUG client.py:179 - root._do_post() ] OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:2311c068b37b4efea03e18929b1d0c28
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20180727173959
<USERID>REDACTED
<USERPASS>REDACTED
<LANGUAGE>ENG
<FI>
<ORG>Citigroup
<FID>24909
</FI>
<APPID>QWIN
<APPVER>2500
</SONRQ>
</SIGNONMSGSRQV1>
<CREDITCARDMSGSRQV1>
<CCSTMTTRNRQ>
<TRNUID>REDACTED
<CLTCOOKIE>4
<CCSTMTRQ>
<CCACCTFROM>
<ACCTID>REDACTED
</CCACCTFROM>
<INCTRAN>
<DTSTART>20180627
<INCLUDE>Y
</INCTRAN>
</CCSTMTRQ>
</CCSTMTTRNRQ>
</CREDITCARDMSGSRQV1>
</OFX>
2018-07-27 17:40:00,083 [DEBUG client.py:183 - root._do_post() ] ---- response ----
2018-07-27 17:40:00,083 [DEBUG client.py:184 - root._do_post() ] {'fp': None, 'debuglevel': 0, '_method': 'POST', 'headers': <http.client.HTTPMessage object at 0x7f51d7b31550>, 'msg': <http.client.HTTPMessage object at 0x7f51d7b31550>, 'version': 11, 'status': 403, 'reason': 'Forbidden', 'chunked': False, 'chunk_left': 'UNKNOWN', 'length': 0, 'will_close': True, 'code': 403}
2018-07-27 17:40:00,083 [DEBUG client.py:185 - root._do_post() ] Headers: [('Server', 'AkamaiGHost'), ('Mime-Version', '1.0'), ('Content-Type', 'text/html'), ('Content-Length', '309'), ('Expires', 'Fri, 27 Jul 2018 21:40:00 GMT'), ('Date', 'Fri, 27 Jul 2018 21:40:00 GMT'), ('Connection', 'close')]
2018-07-27 17:40:00,083 [DEBUG client.py:186 - root._do_post() ] <HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
You don't have permission to access "http://www.accountonline.com/cards/svc/CitiOfxManager.do" on this server.<P>
Reference #18.86c95640.1532727600.3a5b6dc
</BODY>
</HTML>
I'll keep an eye on this...
On python 2.7.13 (debian), TLS v1 is not supported by default. This is reasonable, but the Patelco credit union (and possibly other banks) does not support any later version.
Is it possible to extend ofxclient in some way to support TLSv1? Perhaps by supporting a per-institution configuration?
I was able to patch in support using the following, but there is probably a better way:
index dc2cbf9..c7daf36 100644
--- a/ofxclient/client.py
+++ b/ofxclient/client.py
@@ -15,6 +15,7 @@ except ImportError:
# python 2
from urllib import splittype, splithost
import uuid
+import ssl
DEFAULT_APP_ID = 'QWIN'
DEFAULT_APP_VERSION = '2500'
@@ -132,7 +133,10 @@ class Client:
logging.debug(query)
garbage, path = splittype(i.url)
host, selector = splithost(path)
- h = HTTPSConnection(host, timeout=60)
+ if host == 'ofx.patelco.org':
+ h = HTTPSConnection(host, timeout=60, context=ssl.SSLContext(ssl.PROTOCOL_TLSv1))
+ else:
+ h = HTTPSConnection(host, timeout=60)
# Discover requires a particular ordering of headers, so send the
# request step by step.
h.putrequest('POST', selector, skip_host=True,
I was able to connect using aqbanking in GnuCash, but using the same settings in ofxclient, I receive this:
DEBUG:root:---- response ----
DEBUG:root:{'fp': None, 'debuglevel': 0, '_method': 'POST', 'headers': <http.client.HTTPMessage object at 0x7f3889dc2278>, 'msg': <http.client.HTTPMessage object at 0x7f3889dc2278>, 'version': 11, 'status': 403, 'reason': 'Forbidden', 'chunked': False, 'chunk_left': 'UNKNOWN', 'length': 0, 'will_close': True, 'code': 403}
DEBUG:root:Forbidden
I enabled OFX logging in GnuCash and verified that the SIGNONMSGSRQV1 call sent is the same, including the client args.
Here's my full test case:
In [1]: import logging
In [2]: logging.basicConfig(level=logging.DEBUG)
In [3]: u = 'myusername'
In [4]: p = 'mypassword'
In [5]: from ofxclient import Institution
In [6]: inst = Institution(
...: id = '3101',
...: org = 'AMEX',
...: url = 'https://online.americanexpress.com/myca/ofxdl/desktop/desktopDownload.do?request_type=nl_ofxdownload',
...: username = u,
...: password = p,
...: client_args = {'ofx_version': '102',
...: 'app_version': '1400'} # Quicken Windows 2005
...: )
In [7]: inst.authenticate()
DEBUG:root:posting data to https://online.americanexpress.com/myca/ofxdl/desktop/desktopDownload.do?request_type=nl_ofxdownload
DEBUG:root:---- request ----
DEBUG:root:OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:0cb38c8021284967b4b7adca121d879b
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20190423124337
<USERID>myusername
<USERPASS>mypassword
<LANGUAGE>ENG
<FI>
<ORG>AMEX
<FID>3101
</FI>
<APPID>QWIN
<APPVER>1400
</SONRQ>
</SIGNONMSGSRQV1>
</OFX>
DEBUG:root:---- response ----
DEBUG:root:{'fp': None, 'debuglevel': 0, '_method': 'POST', 'headers': <http.client.HTTPMessage object at 0x7f3889dc2278>, 'msg': <http
.client.HTTPMessage object at 0x7f3889dc2278>, 'version': 11, 'status': 403, 'reason': 'Forbidden', 'chunked': False, 'chunk_left': 'UN
KNOWN', 'length': 0, 'will_close': True, 'code': 403}
DEBUG:root:Forbidden
Chase has made a recent change that breaks ofxclient. They are now requiring that users perform a verification step through their website. The symptom is that download fails and the response is:
<OFX><SIGNONMSGSRSV1><SONRS><STATUS><CODE>15510<SEVERITY>ERROR
<MESSAGE>Please verify your identity within the next 7 days. Using your desktop computer, go to your bank<92>s website and visit the Secure Message Center for instructions.</STATUS><DTSERVER>20151203063424.779[-5:EST]<LANGUAGE>ENG<FI><ORG>B1<FID>10898</FI></SONRS></SIGNONMSGSRSV1><CREDITCARDMSGSRSV1><CCSTMTTRNRS><TRNUID>49048ca8d87a43dd8a6bac3f093984f6<STATUS><CODE>15500<SEVERITY>ERROR</STATUS><CLTCOOKIE>4</CCSTMTTRNRS></CREDITCARDMSGSRSV1></OFX>
The verification in the "Secure Message Center" is not triggered by the existing request. Based on my experiments, the request has to be an OFX 2.1.1 request that includes the new CLIENTUID element in order to trigger the verification step.
https://pypi.python.org/packages/source/o/ofxclient/ofxclient-1.3.8.tar.gz does not contain the tests directory.
I just tried ofxclient and it bombed out as soon as my firewall said that the program was not allowed to connect to HTTP URLs. Please fix the constant API_URL so that it points to a proper, SSL-validating, HTTPS URL. HTTPS is no longer a luxury and there are tons of exploits that could be leveraged against the code reading the easily-MitM'ed HTTP data being downloaded from the URL. Thanks.
$ ofxclient
+----------------------------------
Main
Edit /home/hpk/ofxclient.ini to
change descriptions or ofx options
+----------------------------------
(A) Add an account
(Q) Quit
choice> a
+----------------------------------
Add account
+----------------------------------
Notice
You are about to search for bank connection information
on a third party website. This means you are trusting
http://ofxhome.com and their security policies.
You will be sending your bank name to this website.
bank name eg. "express" (enter to exit)> compass
(0) CompassPC
choice> 0
Traceback (most recent call last):
File "/usr/bin/ofxclient", line 9, in
load_entry_point('ofxclient==2.0.2', 'console_scripts', 'ofxclient')()
File "/usr/lib/python2.7/site-packages/ofxclient-2.0.2-py2.7.egg/ofxclient/cli.py", line 60, in run
main_menu()
File "/usr/lib/python2.7/site-packages/ofxclient-2.0.2-py2.7.egg/ofxclient/cli.py", line 80, in main_menu
add_account_menu()
File "/usr/lib/python2.7/site-packages/ofxclient-2.0.2-py2.7.egg/ofxclient/cli.py", line 126, in add_account_menu
bank = OFXHome.lookup(found[int(choice)]['id'])
File "/usr/lib/python2.7/site-packages/ofxhome-0.3.3-py2.7.egg/ofxhome/init.py", line 29, in lookup
File "/usr/lib/python2.7/site-packages/ofxhome-0.3.3-py2.7.egg/ofxhome/init.py", line 129, in init
File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data '' does not match format '%Y-%m-%d %H:%M:%S'
Found your script on YNAB and followed the trail here. I'm a PHP guy, but have a little Python experience. I'm having trouble w/ the install, I guess something to do w/ my $PATH
:
$ sudo easy_install ofxclient
Searching for ofxclient
Best match: ofxclient 1.3.8
Processing ofxclient-1.3.8-py2.7.egg
ofxclient 1.3.8 is already the active version in easy-install.pth
Installing ofxclient script to /usr/local/share/python
Using /usr/local/lib/python2.7/site-packages/ofxclient-1.3.8-py2.7.egg
Processing dependencies for ofxclient
Finished processing dependencies for ofxclient
$ ofxclient
zsh: command not found: ofxclient
$ which ofxclient
ofxclient not found
I'm sure it's something easy.
I'm using Python 2.7.9 with OfxClient 2.0.3 with DEFAULT_OFX_VERSION = '103'
DEBUG:root:posting data to https://www.oasis.cfree.com/1601.ofxgp
DEBUG:root:---- request ----
DEBUG:root:OFXHEADER:100
DATA:OFXSGML
VERSION:103
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:6e1f7c9279cd4a3da52aac4ad23d32e8
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20170603075704
<USERID>********
<USERPASS>*************
<LANGUAGE>ENG
<FI>
<ORG>Chase Bank
<FID>1601
</FI>
<APPID>QWIN
<APPVER>2500
<CLIENTUID>11b9453ce55c40538fd15b7ed6e356a6
</SONRQ>
</SIGNONMSGSRQV1>
</OFX>
DEBUG:root:---- response ----
DEBUG:root:{'fp': None, 'status': 400, 'will_close': True, 'chunk_left': 'UNKNOWN', 'length': 0, 'strict': 0, 'reason': 'Bad Request', 'version': 11, 'debuglevel': 0, 'msg': <httplib.HTTPMessage instance at 0x75cf32d8>, 'chunked': 0, '_method': u'POST'}
DEBUG:root:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 400--Bad Request</TITLE>
<META NAME="GENERATOR" CONTENT="WebLogic Server">
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 400--Bad Request</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
</FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.1 400 Bad Request</H4>
</FONT><P><FONT FACE="Courier New">The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.</FONT></P>
</FONT></TD></TR>
</TABLE>
</BODY>
</HTML>
authentication failed: 'NoneType' object has no attribute 'find'
Because ofxparse is only at 0.8 (even the git version is only at 0.8)
/usr/lib/python2.7/dist-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently. The code that caused this warning is on line 9 of the file /usr/bin/ofxclient. To get rid of this warning, change code that looks like this: BeautifulSoup([your markup]) to this: BeautifulSoup([your markup], "lxml") markup_type=markup_type)) Traceback (most recent call last): File "/usr/bin/ofxclient", line 9, in <module> load_entry_point('ofxclient==2.0.2', 'console_scripts', 'ofxclient')() File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 60, in run main_menu() File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 80, in main_menu add_account_menu() File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 127, in add_account_menu if login_check_menu(bank): File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 215, in login_check_menu GlobalConfig.add_account(a) File "/usr/lib/python2.7/dist-packages/ofxclient/config.py", line 246, in add_account self.encrypt_account(id=section_id) File "/usr/lib/python2.7/dist-packages/ofxclient/config.py", line 254, in encrypt_account self.parser.set_secure(id, key, value) File "/usr/lib/python2.7/dist-packages/ofxclient/config.py", line 134, in set_secure ConfigParser.set(self, section, option, value) File "/usr/lib/python2.7/dist-packages/configparser.py", line 1233, in set super(ConfigParser, self).set(section, option, value) File "/usr/lib/python2.7/dist-packages/configparser.py", line 930, in set value) File "/usr/lib/python2.7/dist-packages/configparser.py", line 409, in before_set u"position %d" % (value, tmp_value.find(u'%'))) ValueError: invalid interpolation syntax in u'%{secured}' at position 0
c:>ofxclient
+----------------------------------
Main
Edit C:\Users******\ofxclient.ini to
change descriptions or ofx options
+----------------------------------
(A) Add an account
(Q) Quit
choice> A
+----------------------------------
Add account
You are about to search for bank connection information
on a third party website. This means you are trusting
http://ofxhome.com and their security policies.
bank name eg. "express" (enter to exit)> USAA
(0) USAA Federal Savings Bank
(1) USAA Investment Mgmt Co
You are about to test to make sure your username and password
are correct. This means you will be sending it to the URL below.
If the URL does not appear to belong to your bank then you should
exit this program by hitting CTRL-C.
bank name: USAA Federal Savings Bank
username> **********
Traceback (most recent call last):
File "C:\Python27\Scripts\ofxclient-script.py", line 9, in
load_entry_point('ofxclient==2.0.1', 'console_scripts', 'ofxclient')()
File "C:\Python27\lib\site-packages\ofxclient-2.0.1-py2.7.egg\ofxclient\cli.py", line 52, in run
main_menu()
File "C:\Python27\lib\site-packages\ofxclient-2.0.1-py2.7.egg\ofxclient\cli.py", line 72, in main_menu
add_account_menu()
File "C:\Python27\lib\site-packages\ofxclient-2.0.1-py2.7.egg\ofxclient\cli.py", line 119, in add_account_menu
if login_check_menu(bank):
File "C:\Python27\lib\site-packages\ofxclient-2.0.1-py2.7.egg\ofxclient\cli.py", line 185, in login_check_menu
password = getpass.getpass('password> ')
File "C:\Python27\lib\getpass.py", line 95, in win_getpass
msvcrt.putch(c)
TypeError: must be char, not unicode
Hey captin411,
I really appreciate your work in this project.
I was wondering, how come banks keep breaking for different settings and versions of ofxclient. Is it just the nature of this protocol? Is it possible to create a truly stable python ofxclient?
I was recently trying to install ofxclient 2.0.3 on a raspberry pi to connect to Chase bank. I have to admit it is very difficult to make this thing work. Once it works however it's great! :)
I get the following
Traceback (most recent call last):
File "/usr/local/bin/ofxclient", line 9, in
load_entry_point('ofxclient==1.3.8', 'console_scripts', 'ofxclient')()
File "/Library/Python/2.7/site-packages/ofxclient-1.3.8-py2.7.egg/ofxclient/cli.py", line 43, in run
main_menu()
File "/Library/Python/2.7/site-packages/ofxclient-1.3.8-py2.7.egg/ofxclient/cli.py", line 63, in main_menu
add_account_menu()
File "/Library/Python/2.7/site-packages/ofxclient-1.3.8-py2.7.egg/ofxclient/cli.py", line 100, in add_account_menu
bank = OFXHome.lookup(found[int(choice)]['id'])
File "/Library/Python/2.7/site-packages/ofxhome-0.3.1-py2.7.egg/ofxhome/init.py", line 21, in lookup
File "/Library/Python/2.7/site-packages/ofxhome-0.3.1-py2.7.egg/ofxhome/init.py", line 112, in init
File "/Library/Python/2.7/site-packages/ofxhome-0.3.1-py2.7.egg/ofxhome/init.py", line 64, in _text
IndexError: list index out of range
Currently the only way to change the time period of downloaded transactions is to use the --download-days
argument, which specifies how many days before today to start downloading transactions. I would like to be able to specify both a start and an end date for the transactions to download. E.g.: I might want to download my transactions for the previous month, but didn't get around to it until the 5th, so I need a way to exclude the transactions that occurred in the past 5 days.
I have a solution that I hacked together that "works", but I'd like some advice before I turn it into a PR. Would you prefer that I extend the current functionality, adding an argument to specify how many days to exclude? Or should I add new arguments that allow the user to specify a start and an end date instead? For a scenario like I described above, the latter might be better, so that I wouldn't have to calculate how many days I need to use for each argument. Alternatively, should we support both types of arguments?
I download Wells Fargo transactions with the command ofxclient -a [...] -d - -c ~/.config/ofxclient.ini
. This has worked fine for a while, but today, I got TypeError: get() got an unexpected keyword argument 'raw'
. I upgraded from 2.0.2 to 93d2924, which is the current tip of master, but I got the same error. I'm on Ubuntu 16.04.1. Here's the stack trace:
Traceback (most recent call last):
File "/usr/local/bin/ofxclient", line 11, in <module>
load_entry_point('ofxclient==2.0.2', 'console_scripts', 'ofxclient')()
File "/usr/local/lib/python2.7/dist-packages/ofxclient/cli.py", line 40, in run
accounts = GlobalConfig.accounts()
File "/usr/local/lib/python2.7/dist-packages/ofxclient/config.py", line 216, in accounts
for s in self.parser.sections()]
File "/usr/local/lib/python2.7/dist-packages/ofxclient/config.py", line 301, in _section_to_account
section_items = dict(self.parser.items(section))
File "/usr/local/lib/python2.7/dist-packages/ofxclient/config.py", line 100, in items
for k, v in ConfigParser.items(self, section):
File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 878, in items
return [(option, value_getter(option)) for option in d.keys()]
File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 875, in <lambda>
section, option, d[option], d)
File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 384, in before_get
self._interpolate_some(parser, option, L, value, section, defaults, 1)
File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 397, in _interpolate_some
rawval = parser.get(section, option, raw=True, fallback=rest)
TypeError: get() got an unexpected keyword argument 'raw'
I got a new Mac and was configuring my new system to use ofxclient. I keep getting this error while trying to add Citi Credit Card account:
File "/usr/local/bin/ofxclient", line 11, in
load_entry_point('ofxclient==2.0.3', 'console_scripts', 'ofxclient')()
File "/usr/local/lib/python2.7/site-packages/ofxclient-2.0.3-py2.7.egg/ofxclient/cli.py", line 63, in run
main_menu(args)
File "/usr/local/lib/python2.7/site-packages/ofxclient-2.0.3-py2.7.egg/ofxclient/cli.py", line 83, in main_menu
add_account_menu(args)
File "/usr/local/lib/python2.7/site-packages/ofxclient-2.0.3-py2.7.egg/ofxclient/cli.py", line 130, in add_account_menu
if login_check_menu(bank, args):
File "/usr/local/lib/python2.7/site-packages/ofxclient-2.0.3-py2.7.egg/ofxclient/cli.py", line 221, in login_check_menu
GlobalConfig.add_account(a)
File "/usr/local/lib/python2.7/site-packages/ofxclient-2.0.3-py2.7.egg/ofxclient/config.py", line 254, in add_account
self.encrypt_account(id=section_id)
File "/usr/local/lib/python2.7/site-packages/ofxclient-2.0.3-py2.7.egg/ofxclient/config.py", line 261, in encrypt_account
value = self.parser.get(id, key)
File "/usr/local/lib/python2.7/site-packages/ofxclient-2.0.3-py2.7.egg/ofxclient/config.py", line 143, in get
if self.is_secure_option(section, option) and self.keyring_available:
File "/usr/local/lib/python2.7/site-packages/ofxclient-2.0.3-py2.7.egg/ofxclient/config.py", line 84, in is_secure_option
if ConfigParser.get(self, section, option) == self._secure_placeholder:
File "/usr/local/lib/python2.7/site-packages/configparser-3.5.0-py2.7.egg/backports/configparser/init.py", line 811, in get
d)
File "/usr/local/lib/python2.7/site-packages/configparser-3.5.0-py2.7.egg/backports/configparser/init.py", line 384, in before_get
self._interpolate_some(parser, option, L, value, section, defaults, 1)
File "/usr/local/lib/python2.7/site-packages/configparser-3.5.0-py2.7.egg/backports/configparser/init.py", line 397, in _interpolate_some
rawval = parser.get(section, option, raw=True, fallback=rest)
TypeError: get() got an unexpected keyword argument 'raw'
Some googling lead me to believe it is an issue with configparser but I am unable to trouble shoot it any further than that. Any help would be greatly appreciated. Thanks, Joe
Vanguard is returning an empty string as the body. Since around 7/19/2016, I think.
If the --download option is used with python3 then a exception occurs.
File "/usr/local/bin/ofxclient", line 9, in
load_entry_point('ofxclient==2.0.3', 'console_scripts', 'ofxclient')()
File "/usr/local/lib/python3.5/dist-packages/ofxclient-2.0.3-py3.5.egg/ofxclient/cli.py", line 56, in run
args.download.write(ofxdata.read())
TypeError: a bytes-like object is required, not 'str'
I fixed it locally by adding a .encode() call into the strings returned by
ofxdata.read().
However, That's not a fix for both python2&3. I see account.py has some 2/3 support but account.download() doesn't use it.
I noticed this when I first tried using ofxclient about a week ago.
http://downforeveryoneorjustme.com/ofxhome.com seems to confirm it
"BeautifulSoup>=3.0",
in https://github.com/captin411/ofxclient/blob/master/setup.py#L47
BeautifulSoup is marked obsolete by pypi and replaced with beautifulsoup4. So pip install does not work. ref: https://pypi.python.org/pypi/BeautifulSoup/3.2.1
When trying to download transactions your get the following message in the OFX file:
Access Denied
You don't have permission to access "http://www.accountonline.com/cards/svc/CitiOfxManager.do" on this server.
Reference #18.85ce33b8.1489610984.11a85826
If I try to readd the Citi Credit Card bank in the OFXclient I get the following error:
authentication failed: 'NoneType' object has no attribute 'find'
Thanks.
I have a laptop running Ubuntu 18.04 and python 2.7. On this laptop ofxclient 2.0.2 will successfully connect to Charles Schwab Bank and Charles Schwab brokerage and download my account data via OFX.
On my desktop, running NixOS unstable, ofxclient is run with Python 3.7.3 and is version 2.0.3 (latest from PyPI). Here I consistently receive the error:
File "/<nixpath>/lib/python3.7/ssl.py", line 911, in read
return self._sslobj.read(lne, buffer)
socket.timeout: The read operation timed out
It would seem that the ssl library is not properly making the connection. Note that this is not due to network errors, as the machines are on the same home network, can both ping the same hosts, and I have even run ofxclient concurrently on both.
Is there a known bug in the ssl library for python3 that is triggering this? Or is this an issue with ofxclient?
Discover credit cards are broken again.
I'm working on a fix now...
I recently posted another issue about being unable to connect to Chase bank. Whenever I typed ofxclient
into my command prompt, it would just tell me authentication failed
. That problem was fixed (thanks to some help from you guys) by simply typing ofxclient --ofx-version 103
. However, I was immediately met with another issue; when I type my username and password and hit enter, it gives me authentication failed: INVALID ID/PASSWORD
even though I can log in to my chase account just fine with the same credentials.
I found this (#15) article, but am not really sure if it will solve my problem; plus I am not even sure how to do what the people in the thread are talking about.
I thought it might be an issue with the command prompt version of ofxclient, so I pip installed ofxclient for python 3 and tested the example from the front page in jupyter notebook (id = '10898', org = 'B1', url = 'https://ofx.chase.com'). The error I got was ModuleNotFoundError: No module named 'ofxclient'
, even though I had just installed it.
My next thought was to try the python method but from the command prompt instead of jupyter notebook.
C:\Users\my_username>python
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>from ofxclient import Institution
>>>inst = Institution(id='10898',org='B1',url='https://ofx.chase.com',username='my_username',password='my_password')
>>>accounts=inst.accounts()
>>>for a in accounts:
... download=a.download(days=5)
... print(download.read())
... statement = a.statement(days=5)
... print(statement.balance)
...
>>>
As you can see, it seems to be able to tell that the module is installed, and it didn't give me any username/password error, but it doesn't print anything. I am extremely frustrated with this because I know that when I get it to work, ofxclient will be extremely powerful. Any and all help would be very much appreciated.
ofxclient chokes on my old (previously-working) ofxclient.ini, as well as on attempts to newly create one:
Traceback (most recent call last):
File "/usr/bin/ofxclient", line 9, in
load_entry_point('ofxclient==2.0.2', 'console_scripts', 'ofxclient')()
File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 60, in run
main_menu()
File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 80, in main_menu
add_account_menu()
File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 127, in add_account_menu
if login_check_menu(bank):
File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 215, in login_check_menu
GlobalConfig.add_account(a)
File "/usr/lib/python2.7/dist-packages/ofxclient/config.py", line 246, in add_account
self.encrypt_account(id=section_id)
File "/usr/lib/python2.7/dist-packages/ofxclient/config.py", line 254, in encrypt_account
self.parser.set_secure(id, key, value)
File "/usr/lib/python2.7/dist-packages/ofxclient/config.py", line 134, in set_secure
ConfigParser.set(self, section, option, value)
File "/usr/lib/python2.7/dist-packages/configparser.py", line 1233, in set
super(ConfigParser, self).set(section, option, value)
File "/usr/lib/python2.7/dist-packages/configparser.py", line 930, in set
value)
File "/usr/lib/python2.7/dist-packages/configparser.py", line 409, in before_set
u"position %d" % (value, tmp_value.find(u'%')))
ValueError: invalid interpolation syntax in u'%{secured}' at position 0
I would just like to read the pending/scheduled payments, not schedule new payments.
If anyone knows what the correct ofx requests are for this, I'd like to try them out with a local copy and fix this myself. At the moment, however, I'm not sure whether my bank even supports this.
I keep getting this name error when trying to add new accounts. It doesn't matter which bank, I get the same error on every one. I suppose this is some type of configuration error but can't figure it out.
I'm on a ubuntu machine, installed with apt-get and made sure I had all dependencies installed.
full traceback looks like this:
Traceback (most recent call last):
File "/usr/bin/ofxclient", line 11, in <module>
load_entry_point('ofxclient==2.0.2', 'console_scripts', 'ofxclient')()
File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 63, in run
main_menu(args)
File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 83, in main_menu
add_account_menu(args)
File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 130, in add_account_menu
if login_check_menu(bank, args):
File "/usr/lib/python2.7/dist-packages/ofxclient/cli.py", line 209, in login_check_menu
client_args={ofx_version: args.ofx_version}
NameError: global name 'ofx_version' is not defined
DEBUG:root:posting data to https://online.americanexpress.com/myca/ofxdl/desktop/desktopDownload.do?request_type=nl_ofxdownload
DEBUG:root:---- request ----
DEBUG:root:OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:b9ffc76190234a33875ea8f79f79829c
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20164867024420
<USERID><username>
<USERPASS><password>
<LANGUAGE>ENG
<FI>
<ORG>AMEX
<FID>3101
</FI>
<APPID>QWIN
<APPVER>2200
</SONRQ>
</SIGNONMSGSRQV1>
</OFX>
DEBUG:root:---- response ----
DEBUG:root:{'length': 0, 'reason': 'OK', 'code': 200, 'debuglevel': 0, 'version': 11, 'will_close': False, 'chunked': False, 'chunk_left': 'UNKNOWN', 'msg': <http.client.HTTPMessage object at 0x108708780>, 'status': 200, '_method': 'POST', 'fp': None, 'headers': <http.client.HTTPMessage object at 0x108708780>}
DEBUG:root:OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:b9ffc76154374a33875ea8f79f79829c
<OFX><SIGNONMSGSRSV1><SONRS><STATUS><CODE>0<SEVERITY>INFO<MESSAGE>Login successful</STATUS><DTSERVER>20160315234421.027[-7:MST]<LANGUAGE>ENG<FI><ORG>AMEX<FID>3101</FI><ORIGIN.ID>FMPWeb<CUSTOMER.TYPE>BCM<START.TIME>20160315234421</SONRS></SIGNONMSGSRSV1></OFX>
authentication failed: 'NoneType' object has no attribute 'find'
I'm getting a TypeError when I try to list the accounts for my institution:
*** Python 3.4.5 |Anaconda 2.1.0 (64-bit)| (default, Jul 5 2016, 14:53:07) [MSC v.1600 64 bit (AMD64)] on win32. ***
>>> institution.accounts()
Traceback (most recent call last):
File "<string>", line 301, in runcode
File "<interactive input>", line 1, in <module>
File "C:\Anaconda3\lib\site-packages\ofxclient\institution.py", line 143, in accounts
parsed = OfxParser.parse(resp_handle)
File "C:\Anaconda3\lib\site-packages\ofxparse\ofxparse.py", line 398, in parse
ofx_file = OfxPreprocessedFile(file_handle)
File "C:\Anaconda3\lib\site-packages\ofxparse\ofxparse.py", line 168, in __init__
super(OfxPreprocessedFile, self).__init__(fh)
File "C:\Anaconda3\lib\site-packages\ofxparse\ofxparse.py", line 98, in __init__
self.read_headers()
File "C:\Anaconda3\lib\site-packages\ofxparse\ofxparse.py", line 104, in read_headers
head_data = head_data[:head_data.find(six.b('<'))]
TypeError: Can't convert 'bytes' object to str implicitly
The SSL certificates are checked by default with python 2.7.9 according to PEP 476 and most of my ofx sites now fail this check.
Ideally I think ofxclient should try with the certificate checking and then allow the option of continuing without the check (by using the context returned from ssl._create_unverified_context()) and warning of the problem.
The behavior with 2.7.8 and before was to skip checking these certificates
Charles Schwab requires headers to be set to None otherwise the request times out.
Quick fix is to set DEFAULT_USER_AGENT
in client.py
to None
, then add the Schwab account and switch the value back.
I plan on opening a PR to add logic similar to
Lines 242 to 244 in 6d6db69
cli.py : 209
NameError: global name 'ofx_version' is not defined
Missing quotes around ofx_version cause crash on Win7 with Python 2.7.10.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.