PublicIds and query from python script

update the response format of publicIds and remove the error caused by
query regarding to python script.