标签:
接入流程例如以下,须要先注冊开发人员帐号,之后会得到一个32位的key,保存下来,用于以后发送数据。http://www.tuling123.com/
请求方式
演示样例:
# -*- coding: utf-8 -*- import urllib import json def getHtml(url): page = urllib.urlopen(url) html = page.read() return html if __name__ == '__main__': key = '8b005db5f57556fb96dfd98fbccfab84' api = 'http://www.tuling123.com/openapi/api?key=' + key + '&info=' while True: info = raw_input('我: ') request = api + info response = getHtml(request) dic_json = json.loads(response) print '机器人: '.decode('utf-8') + dic_json['text']
标签:
原文地址:http://www.cnblogs.com/bhlsheji/p/4391667.html