def exec_def(cmd_str, obj): import requests print(requests.post("http://172.18.162.173:8000/exec", json={ "function_str": cmd_str, "call_str": "exec(obj)", "param_dict": { "obj": obj } }).json()) # ================[ 自定义部分 Start ]=============== exec_str = """ def exec(obj): return obj """ obj = {"b": 45, 'zScore': None} # ================[ 自定义部分 End ]=============== print(exec_def(exec_str, obj))