update the python script and refactor API
fix a bug
Merge pull request #2392 from yorkerlin/develop

update the python script and API