import requests import json while True: msg = input('我:') sess = requests.get( ('https://open.drea.cc/bbsapi/chat/get?keyWord=' + msg + '&userName=type%3Dbbs')) js = sess.text js = json.loads(js) print('微梦机器人:', js['data']['reply'])