37,743
社区成员




def robot(content):
api = r'http://openapi.tuling123.com/openapi/api/v2'
data = {
"perception": {
"inputText": {
"text": content
}
},
"userInfo": {
"apiKey": "",
"userId": 'yau',
}
}
jsondata = json.dumps(data)
response = requests.post(api, data=jsondata)
robot_res = json.loads(response.content)
print(robot_res["results"][0]['values']['text'])
while True:
content = input("USER:")
robot(content)
调用了一个bot,然后用tkinter写了一个类似qq的简单聊天界面,想通过这个界面直接和bot交流,不需要经过cmd。