-
Notifications
You must be signed in to change notification settings - Fork 3
/
example.py
107 lines (87 loc) · 2.22 KB
/
example.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import requests
import json
import sys # for testing
url = "http://129.21.82.254:5000"
args = {}
args['accountNum'] = "0112345678"
args['password'] = "test3"
#args['challenge'] = "H`:L]oo$M5"
loc = "/getSession"
response = requests.post(url+loc,data=args)
decodedOut = json.loads(response.text)
session = None
if isinstance(decodedOut, dict):
session = decodedOut['SessionID']
else:
print decodedOut
sys.exit()
args = {}
args['accountNum'] = "0112345678"
args['session'] = session
loc = "/getBalance"
response = requests.post(url+loc,data=args)
decodedOut = json.loads(response.text)
if isinstance(decodedOut, dict):
print decodedOut['Balance']
else:
print decodedOut
args = {}
args['accountNum'] = "0112345678"
args['password'] = "test3"
args['session'] = session
args['newPassword'] = "test3"
loc = "/changePassword"
response = requests.post(url+loc,data=args)
decodedOut = json.loads(response.text)
if isinstance(decodedOut, dict):
print decodedOut['Status']
else:
print decodedOut
args = {}
args['accountNum'] = "0112345678"
args['destAccount'] = "0112345678"
args['session'] = session
args['amount'] = "108"
loc = "/transferMoney"
response = requests.post(url+loc,data=args)
decodedOut = json.loads(response.text)
if isinstance(decodedOut, dict):
print decodedOut['Status']
else:
print decodedOut
# Pay Bill
args = {}
args['accountNum'] = "0112345678"
args['destAccount'] = "123456781"
args['session'] = session
args['amount'] = "1234"
args['payBill'] = "1"
loc = "/transferMoney"
response = requests.post(url+loc,data=args)
decodedOut = json.loads(response.text)
if isinstance(decodedOut, dict):
print decodedOut['Status']
else:
print decodedOut
args = {}
args['accountNum'] = "0112345678"
args['session'] = session
args['newPin'] = "1235"
args['pin'] = "1234"
loc = "/changePin"
response = requests.post(url+loc,data=args)
decodedOut = json.loads(response.text)
if isinstance(decodedOut, dict):
print decodedOut['Status']
else:
print decodedOut
args = {}
args['accountNum'] = "0112345678"
args['session'] = session
loc = "/wasBillPaid"
response = requests.post(url+loc,data=args)
decodedOut = json.loads(response.text)
if isinstance(decodedOut, dict):
print decodedOut['Status']
else:
print decodedOut