Merge pull request #469 from Atheros1/master
new API command: listAddressBook
This commit is contained in:
commit
32b682d5bf
|
@ -171,6 +171,17 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
streamNumber, 'enabled': shared.config.getboolean(addressInKeysFile, 'enabled')}, indent=4, separators=(',', ': '))
|
streamNumber, 'enabled': shared.config.getboolean(addressInKeysFile, 'enabled')}, indent=4, separators=(',', ': '))
|
||||||
data += ']}'
|
data += ']}'
|
||||||
return data
|
return data
|
||||||
|
elif method == 'listAddressBook' or method == 'listAddressbook':
|
||||||
|
queryreturn = sqlQuery('''SELECT label, address from addressbook''')
|
||||||
|
data = '{"addresses":['
|
||||||
|
for row in queryreturn:
|
||||||
|
label, address = row
|
||||||
|
label = shared.fixPotentiallyInvalidUTF8Data(label)
|
||||||
|
if len(data) > 20:
|
||||||
|
data += ','
|
||||||
|
data += json.dumps({'label':label.encode('base64'), 'address': address}, indent=4, separators=(',', ': '))
|
||||||
|
data += ']}'
|
||||||
|
return data
|
||||||
elif method == 'createRandomAddress':
|
elif method == 'createRandomAddress':
|
||||||
if len(params) == 0:
|
if len(params) == 0:
|
||||||
raise APIError(0, 'I need parameters!')
|
raise APIError(0, 'I need parameters!')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user