Enter.py 900 B

12345678910111213141516171819202122232425262728293031323334
  1. import sys
  2. import json
  3. import Api
  4. import io
  5. def main():
  6. # 创建一个使用UTF-8编码的包装器
  7. sys.stdin = io.TextIOWrapper(sys.stdin.detach(), encoding='utf-8')
  8. # 从标准输入读取JSON字符串
  9. input_json = sys.stdin.read().strip()
  10. # 解析JSON数据
  11. inputData = json.loads(input_json)
  12. # 从输入数据中获取调用接口
  13. api = inputData["api"]
  14. if (api == "addPerson"):
  15. result = Api.addPerson(inputData)
  16. elif (api == "createContract"):
  17. result = Api.createContract(inputData)
  18. elif (api == "addSigner"):
  19. result = Api.addSigner(inputData)
  20. elif (api == "downloadContract"):
  21. result = Api.downloadContract(inputData)
  22. elif (api == "contractStatus"):
  23. result = Api.contractStatus(inputData)
  24. else:
  25. result = ""
  26. # 输出结果
  27. print(result)
  28. if __name__ == "__main__":
  29. main()