資源簡介
這是一個簡單的用python結合圖靈機器人api做成的微信個人號機器人的實例,需要引用 itchat 開源庫(pip install itchat)
代碼片段和文件信息
import?itchattimere
from?itchat.content?import?*
import?urllib2urllib
import?json
@itchat.msg_register([TEXT])
def?text_reply(msg):
????info?=?msg[‘Text‘].encode(‘UTF-8‘)
????url?=?‘http://www.tuling123.com/openapi/api‘
????data?=?{u“key“:“4b069f73bfdb4af0a67120491066418b““info“:infou“loc“:“““userid“:““}
????data=urllib.ur
- 上一篇:Python使用微信實現兩個機器人的聊天
- 下一篇:多線程socket編程
評論
共有 條評論