Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept parameters to accounts() to pass on to account_list_query() #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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