2
def __curl(ip, port, method, args):
3
return curllib.url_post(ip, port, False, method, args)
5
def __curlget(ip, port, args):
6
return curllib.url_get(ip, port, False, None)
8
def MainIndex(ip, port):
9
return curllib.url_post(ip, port, False, None, None)
13
return curllib.url_post(ip, port, False, "root", None)
15
def GetIndex(ip, port, sender, receiver, amount, retries=3):
16
return __curlget(ip, port, {})
18
def CreateTransfer(ip, port, sender, receiver, amount, retries=3):
20
args['sender'] = sender
21
args['receiver'] = receiver
22
args['amount'] = amount
23
args['retries'] = retries
24
return __curl(ip, port, "createtransfer", args)
26
def CreateAccount(ip, port, account, balance):
28
args['account'] = account
29
args['balance'] = balance
30
return __curl(ip, port, "createaccount", args)
32
def BatchCreateAccount(ip, port, numaccounts, offset, balance):
34
args['numaccounts'] = str(numaccounts)
35
args['balance'] = str(balance)
36
args['offset'] = str(offset)
37
return __curl(ip, port, "batchcreateaccount", args)
39
def BatchDeleteAccount(ip, port, numaccount, offset, balance):
41
args['numaccounts'] = numaccount
42
args['offset'] = offset
43
args['balance'] = balance
44
return __curl(ip, port, "batchdeleteaccount", args)
46
def DeleteAccount(ip, port, account):
48
args['account'] = account
49
return __curl(ip, port, "deleteaccount", args)
51
def GetAccount(ip, port, account):
53
args['account'] = account
54
return __curl(ip, port, "getaccount", args)