Commit eddb0d24 authored by litaolemo's avatar litaolemo

update

parent 7183d859
......@@ -3,6 +3,7 @@
# @File : rpc_data_to_answer.py
# @email : litao@igengmei.com
# @author : litao
import copy
import requests
import typing
......@@ -36,16 +37,34 @@ data_type_dict = {
"cims/reply/batch_create": ["platform","platform_id","platform_answer_id","content","user_id","create_time","is_online"]
}
def post_muilty_data(data_list:typing.List,rpc_type:str) -> typing.Dict:
headers = {
'X-GAIA-HELIOS-VERSION': '0.7.5',
}
for data_dict in data_list:
for key in data_dict:
if key not in data_type_dict[rpc_type]:
data_dict.pop(key)
dic = {"questions":data_list}
invoker = create_default_invoker(debug=True).with_config(dump_curl=True)
res = invoker[rpc_type](**dic)
# print(res.)
print(res)
print(res.unwrap())
return res
def post_single_data(data_dict:typing.Dict,rpc_type:str) -> typing.Dict:
headers = {
'X-GAIA-HELIOS-VERSION': '0.7.5',
}
for key in data_dict:
data_dict_copy = copy.deepcopy(data_dict)
for key in data_dict_copy:
if key not in data_type_dict[rpc_type]:
data_dict.pop(key)
print(data_dict)
dic = {"questions":[data_dict]}
data_dict_copy.pop(key)
print(data_dict_copy)
dic = {"questions":[data_dict_copy]}
invoker = create_default_invoker(debug=True).with_config(dump_curl=True)
res = invoker[rpc_type](**dic)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment