-
-
Save tejastank/89a0e0bc55a0fcacd6bc446df3d6d4cc to your computer and use it in GitHub Desktop.
Get transactions via Yodlee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
URL_BASE = 'https://rest.developer.yodlee.com/services/srest/restserver/v1.0' | |
# assumes you've signed up for dev access, and already done the one-time linking of bank accounts | |
# to user accounts via the Yodlee website | |
# cobrand login | |
payload = { 'cobrandLogin': 'sbCob<account>', 'cobrandPassword': '<something>' } | |
r = requests.post(URL_BASE + '/authenticate/coblogin', params=payload) | |
d = json.loads(r.content) | |
cob_token = d['cobrandConversationCredentials']['sessionToken'] | |
print cob_token | |
# user login | |
payload2 = {'cobSessionToken': cob_token, 'login': 'sbMem<account>1', 'password': 'sbMem<account>1#123' } | |
r2 = requests.post(URL_BASE + '/authenticate/login', params=payload2) | |
d2 = json.loads(r2.content) | |
user_token = d2['userContext']['conversationCredentials']['sessionToken'] | |
print user_token | |
# search transactions | |
payload3 = { | |
'cobSessionToken': cob_token, | |
'userSessionToken': user_token, | |
'transactionSearchRequest.containerType': 'bank', | |
'transactionSearchRequest.higherFetchLimit': 500, | |
'transactionSearchRequest.lowerFetchLimit': 1, | |
'transactionSearchRequest.resultRange.endNumber': 500, | |
'transactionSearchRequest.resultRange.startNumber': 1, | |
'transactionSearchRequest.searchClients.clientId': 1, | |
'transactionSearchRequest.searchClients.clientName': 'DataSearchService', | |
'transactionSearchRequest.ignoreUserInput': True, | |
'transactionSearchRequest.searchFilter.postDateRange.fromDate': '01-01-2013', | |
'transactionSearchRequest.searchFilter.postDateRange.toDate': '08-01-2014', | |
'transactionSearchRequest.searchFilter.transactionSplitType': 'ALL_TRANSACTION' | |
} | |
r3 = requests.post(URL_BASE + '/jsonsdk/TransactionSearchService/executeUserSearchRequest', params=payload3) | |
d3 = json.loads(r3.content) | |
for t in d3['searchResult']['transactions']: | |
print t.['postDate'], t['description']['description'], t['amount']['amount'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment