actuator_test.py 906 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. def exec_def(cmd_str, obj):
  2. import requests
  3. json = requests.post("http://172.18.162.173:8000/exec", json={"function_str": cmd_str, "call_str": "exec(obj)", "param_dict": {"obj": obj}}).json()
  4. print(json)
  5. # ================[ 自定义部分 Start ]===============
  6. exec_str = """
  7. def exec(obj):
  8. return obj
  9. """
  10. obj = {
  11. "mail_type": "其他",
  12. "establish_time": None,
  13. "registcapi": "0.0",
  14. "reccap": "",
  15. "if_fest_phone": "是",
  16. "industry": None,
  17. "stockpercent": None,
  18. "subindustry": None,
  19. "credit_no": "111000000036931723",
  20. "cn_stockname": None,
  21. "province": "福建省",
  22. "econkind": None,
  23. "cn_change": None,
  24. "last_day_faren_change": None
  25. }
  26. # ================[ 自定义部分 End ]===============
  27. exec_def(exec_str, obj)
  28. def exec(obj):
  29. if 'name3' in obj:
  30. obj['name3'] = 1
  31. else:
  32. obj['name3'] = 2
  33. return obj