Enter.py 817 B

1234567891011121314151617181920212223242526272829303132
  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. else:
  23. result = ""
  24. # 输出结果
  25. print(result)
  26. if __name__ == "__main__":
  27. main()