-
Notifications
You must be signed in to change notification settings - Fork 1
/
plaid_client.py
28 lines (22 loc) · 1013 Bytes
/
plaid_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import json
from plaid import Client
class Plaid:
def __init__(self, clientId, clientSecret, accessToken=None):
self.client = Client(client_id=clientId, secret=clientSecret, access_token=accessToken)
def connect(self, accountType, username, password, email):
connect = self.client.connect(account_type=accountType, username=username, password=password, email=email)
if connect.ok:
json_response = json.loads(connect.content)
return json_response;
def answerMFA(self, accountType, mfaAnswer):
step = self.client.step(account_type=accountType, mfa=mfaAnswer)
if step.ok:
transactions = json.loads(step.content)
return transactions
def getTransactions(self, options=None):
transactions = self.client.transactions(options)
if transactions.ok:
transactions = json.loads(transactions.content)
return transactions
def delete(self):
self.client.delete_user()