-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmm_score.py
88 lines (79 loc) · 1.93 KB
/
mm_score.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import json
import requests
BASEURL = "http://172.26.38.244"
USER = "sasdemo"
PWD = "sas123"
MODNAME = "HMEQ_LOGI_0225"
def get_token(url, username, password):
headers = {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic c2FzLmVjOg=='
}
payload = 'grant_type=password&username='+username+'&password='+password
response = requests.post(url+'/SASLogon/oauth/token',
data=payload, headers=headers)
auth_json = json.loads(response.content.decode())
return auth_json['access_token']
token = get_token(BASEURL, USER, PWD)
headers = {
'Authorization': 'bearer ' + token,
'Content-Type': 'application/json ; application/vnd.sas.microanalytic.module.step.input+json',
'Access-Control-Allow-Origin': "*"
}
URL = ("%s/microanalyticScore/modules/%s/steps/score") % (BASEURL, MODNAME)
parms = {
"version": 1,
"inputs": [
{
"name": "LOAN",
"value": 1700
},
{
"name": "MORTDUE",
"value": 97800
},
{
"name": "VALUE",
"value": 112000
},
{
"name": "REASON",
"value": "HomeImp"
},
{
"name": "JOB",
"value": "Office"
},
{
"name": "YOJ",
"value": 3
},
{
"name": "DEROG",
"value": 0
},
{
"name": "DELINQ",
"value": 0
},
{
"name": "CLAGE",
"value": 93.33333
},
{
"name": "NINQ",
"value": 0
},
{
"name": "CLNO",
"value": 14
},
{
"name": "DEBTINC",
"value": 0
}
]
}
res = requests.post(URL, headers=headers, data=json.dumps(parms)).json()
print(res)