Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ofxclient/institution.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ def authenticate(self, username=None, password=None):

raise ValueError(status)

def accounts(self):
def accounts(self, date='19700101000000'):
"""Ask the bank for the known :py:class:`ofxclient.Account` list.

:rtype: list of :py:class:`ofxclient.Account` objects
"""
from ofxclient.account import Account
client = self.client()
query = client.account_list_query()
query = client.account_list_query(date)
resp = client.post(query)
resp_handle = StringIO(resp)

Expand All @@ -147,6 +147,10 @@ def accounts(self):
else:
parsed = OfxParser.parse(BytesIO(resp_handle.read().encode()))

if not parsed.accounts and len(date) > 8:
# TD Bank doesn't support full date/time string here
return self.accounts(date=date[:8])

return [Account.from_ofxparse(a, institution=self)
for a in parsed.accounts]

Expand Down