test_py_invoke.py 484 B

123456789101112131415161718192021
  1. def exec_def(cmd_str, obj):
  2. import requests
  3. print(requests.post("http://172.18.162.173:8000/exec", json={
  4. "function_str": cmd_str,
  5. "call_str": "exec(obj)",
  6. "param_dict": {
  7. "obj": obj
  8. }
  9. }).json())
  10. # ================[ 自定义部分 Start ]===============
  11. exec_str = """
  12. def exec(obj):
  13. return obj
  14. """
  15. obj = {"b": 45, 'zScore': None}
  16. # ================[ 自定义部分 End ]===============
  17. print(exec_def(exec_str, obj))