Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 4 additions & 6 deletions plaid/api/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Balance(API):

def get(self,
access_token,
_options={},
_options=None,
account_ids=None):
'''
Retrieve real-time balance information for accounts.
Expand All @@ -15,8 +15,7 @@ def get(self,
:param [str] account_ids: A list of account_ids to retrieve for
the item. Optional.
'''
options = {}
options.update(_options)
options = _options or {}
if account_ids is not None:
options['account_ids'] = account_ids

Expand All @@ -41,7 +40,7 @@ def __init__(self, client):

def get(self,
access_token,
_options={},
_options=None,
account_ids=None):
'''
Retrieve high-level account information for an Item.
Expand All @@ -50,8 +49,7 @@ def get(self,
:param [str] account_ids: A list of account_ids to retrieve for
the item. Optional.
'''
options = {}
options.update(_options)
options = _options or {}
if account_ids is not None:
options['account_ids'] = account_ids

Expand Down
7 changes: 4 additions & 3 deletions plaid/api/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, client):
def create(self,
access_tokens,
days_requested,
options={}):
options=None):
'''
Create an asset report.

Expand All @@ -25,6 +25,7 @@ def create(self,
information on the options object, see
the documentation site listed above.
'''
options = options or {}

return self.client.post('/asset_report/create', {
'access_tokens': access_tokens,
Expand All @@ -44,7 +45,6 @@ def filter(self,
exclude from the new Asset
Report.
'''

return self.client.post('/asset_report/filter', {
'asset_report_token': asset_report_token,
'account_ids_to_exclude': account_ids_to_exclude,
Expand All @@ -53,7 +53,7 @@ def filter(self,
def refresh(self,
asset_report_token,
days_requested,
options={}):
options=None):
'''
Create a new, refreshed asset report based on an existing asset report.

Expand All @@ -65,6 +65,7 @@ def refresh(self,
:param dict options: An optional dictionary. This is the
same object used in `create`.
'''
options = options or {}

return self.client.post('/asset_report/refresh', {
'asset_report_token': asset_report_token,
Expand Down
5 changes: 2 additions & 3 deletions plaid/api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Auth(API):

def get(self,
access_token,
_options={},
_options=None,
account_ids=None):
'''
Retrieve account and routing numbers for checking and savings accounts.
Expand All @@ -16,8 +16,7 @@ def get(self,
:param [str] account_ids: A list of account_ids to retrieve for
the item. Optional.
'''
options = {}
options.update(_options)
options = _options or {}
if account_ids is not None:
options['account_ids'] = account_ids

Expand Down
10 changes: 7 additions & 3 deletions plaid/api/institutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ def get(self, count, offset=0):
'offset': offset,
})

def get_by_id(self, institution_id, _options={}):
def get_by_id(self, institution_id, _options=None):
'''
Fetch a single institution by id.

:param str institution_id:
'''
options = _options or {}

return self.client.post_public_key('/institutions/get_by_id', {
'institution_id': institution_id,
'options': _options,
'options': options,
})

def search(self, query, _options={}, products=None):
Expand All @@ -38,8 +40,10 @@ def search(self, query, _options={}, products=None):
institutions.
:param [str] products: Filter FIs by available products. Optional.
'''
options = _options or {}

return self.client.post_public_key('/institutions/search', {
'query': query,
'products': products,
'options': _options,
'options': options,
})
16 changes: 10 additions & 6 deletions plaid/api/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class Credentials(API):
'''Item Credentials endpoints.'''

def update(self, access_token, credentials, _options={}):
def update(self, access_token, credentials, _options=None):
'''
Update the credentials associated with an item.

Expand All @@ -13,6 +13,8 @@ def update(self, access_token, credentials, _options={}):

:param dict credentials: See ``Item.create`` for details.
'''
_options = _options or {}

return self.client.post('/item/credentials/update', {
'access_token': access_token,
'credentials': credentials,
Expand Down Expand Up @@ -117,7 +119,7 @@ def create(self,
credentials,
institution_id,
initial_products,
_options={},
_options=None,
transactions__start_date=None,
transactions__end_date=None,
transactions__await_results=None,
Expand Down Expand Up @@ -155,17 +157,17 @@ def create(self,

All dates should be formatted as ``YYYY-MM-DD``.
'''
options = _options or {}

transaction_options = {}
transaction_options.update(_options.get('transactions', {}))
transaction_options.update(options.get('transactions', {}))
if transactions__start_date is not None:
transaction_options['start_date'] = transactions__start_date
if transactions__end_date is not None:
transaction_options['end_date'] = transactions__end_date
if transactions__await_results is not None:
transaction_options['await_results'] = transactions__await_results

options = {}
options.update(_options)
if transaction_options:
options['transactions'] = transaction_options
if webhook is not None:
Expand All @@ -178,14 +180,16 @@ def create(self,
'options': options,
})

def mfa(self, access_token, mfa_type, responses, _options={}):
def mfa(self, access_token, mfa_type, responses, _options=None):
'''
Provide an MFA (Multi-Factor Authentication) response for an item.

:param str access_token:
:param str mfa_type: The type of mfa answered (e.g. device)
:param [str] responses: The MFA response(s)
'''
_options = _options or {}

return self.client.post('/item/mfa', {
'access_token': access_token,
'mfa_type': mfa_type,
Expand Down
6 changes: 3 additions & 3 deletions plaid/api/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PublicToken(API):
def create(self,
institution_id,
initial_products,
_options={},
_options=None,
webhook=None):
'''
Generate a public token for sandbox testing.
Expand All @@ -32,8 +32,8 @@ def create(self,

:param str webhook:
'''
options = {}
options.update(_options)
options = _options or {}

if webhook is not None:
options['webhook'] = webhook

Expand Down
6 changes: 3 additions & 3 deletions plaid/api/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def get(self,
access_token,
start_date,
end_date,
_options={},
_options=None,
account_ids=None,
count=None,
offset=None,
Expand All @@ -33,8 +33,8 @@ def get(self,

All date should be formatted as ``YYYY-MM-DD``.
'''
options = {}
options.update(_options)
options = _options or {}

if account_ids is not None:
options['account_ids'] = account_ids
if count is not None:
Expand Down