-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccountApp.py
executable file
·49 lines (40 loc) · 1.92 KB
/
AccountApp.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#Copyright (c) 2015 Yodlee, Inc. All Rights Reserved.
# This software is the confidential and proprietary information of Yodlee, Inc.
# Use is subject to license terms.
import loginapp #importing loginapp, to get a coBrand and User Session response and used
import http1 #importing http1, its the key for all the apps, and to post and get the json response
import json #library package for the json response access
import requests #requests, for requesting the response from json
#<summary>
#The AccountApp class provides authentication and authorization services.
#Steps to Use this App:
#i) doCoBrandLogin(coBrandUserName, coBrandPassword)
#ii) doMemberLogin(userName, userPassword)
#Browse all Accounts for member profile:
# getAccounts()
class AccountApp:
fqcn = "AccountApp"
global userSession
global cobSession
@staticmethod
def getAccounts():
global userSession
global cobSession
uSession = loginapp.userSession
cSession = loginapp.cobSession
hdr = {'Authorization':'{userSession='+uSession+',cobSession='+cSession+'}'}
mn = "getAccounts()"
print(AccountApp.fqcn + " :: " + mn)
accountSummaryURL = loginapp.LoginApp.localURLVer1 + "v1/accounts"
jsonResponse = http1.HTTP.doGet(accountSummaryURL,hdr)
parsed_json = json.loads(jsonResponse)
node = parsed_json.get("account",{})
print '--------------------------------------------------------------------------'
print "Account Id - Account Name - Account Status"
print '--------------------------------------------------------------------------'
for i in node:
if ('accountName' in i):
print i['id']," - ",i['accountName']," - ",i['accountStatus']
elif (not ('accountName' in i)):
print i['id'], " - "," - ", " - ", i['accountStatus']
print '--------------------------------------------------------------------------'