-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSiteApp.py
executable file
·70 lines (59 loc) · 2.32 KB
/
SiteApp.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#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 yaml #converts unicode to bytecode
#global parsed_json
#global siteResponse
class SiteApp:
fqcn = "SiteApp"
global userSession
global cobSession
global uSession
global cSession
global jsonResponse
siteResponse=''
#<summary>
#searchSite method will search for the site name
#<param name="searchString"></param> site name to be searched
@staticmethod
def searchSite(searchString):
global userSession
global cobSession
global uSession
global cSession
uSession = loginapp.userSession
cSession = loginapp.cobSession
data = {'Authorization':'{userSession='+uSession+',cobSession='+cSession+'}'}
mn = "searchSite(searchString " + searchString + " )"
#print(SiteApp.fqcn + " :: " + mn)
searchSiteURL = loginapp.LoginApp.localURLVer1 + "v1/providers?name="+searchString
jsonResponse = http1.HTTP.doGet(searchSiteURL, data)
#print jsonResponse
print jsonResponse
parsed_json = json.loads(jsonResponse)
#import pdb
#pdb.set_trace()
#print parsed_json
for provider_object in parsed_json['provider']:
print provider_object['id']," => ",provider_object['name']
#print provider_object['name']
#print i['id'],"=>",i['name']
#<summary>
#the getSiteLoginFrom method search for the site id
@staticmethod
def getSiteLoginForm(sitId):
global uSession
global cSession
global jsonResponse
uSession = loginapp.userSession
cSession = loginapp.cobSession
data = {'Authorization':'{userSession='+uSession+',cobSession='+cSession+'}'}
mn = "searchSite(siteId " + sitId + " )"
#print(SiteApp.fqcn + " :: " + mn)
getSiteLoginFormURL = loginapp.LoginApp.localURLVer1 + "v1/providers/" + sitId
jsonResponse = http1.HTTP.doGet(getSiteLoginFormURL, data)
#print jsonResponse
SiteApp.siteResponse = jsonResponse