Skip to content

Commit f6f48df

Browse files
committed
tuling
1 parent 06e4d5d commit f6f48df

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tuling_wechat.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import itchat,time,re
2+
from itchat.content import *
3+
import urllib2,urllib
4+
import json
5+
6+
@itchat.msg_register([TEXT])
7+
def text_reply(msg):
8+
info = msg['Text'].encode('UTF-8')
9+
url = 'http://www.tuling123.com/openapi/api'
10+
data = {u"key":"549a637dc31242009a448bfa0815e8ef","info":info,u"loc":"","userid": ""}
11+
data = urllib.urlencode(data)
12+
url2 = urllib2.Request(url,data)
13+
response = urllib2.urlopen(url2)
14+
apicontent = response.read()
15+
s = json.loads(apicontent,encoding='utf-8')
16+
print 's==',s
17+
if s['code'] == 100000:
18+
itchat.send(s['text'],msg['FromUserName'])
19+
20+
itchat.auto_login(enableCmdQR=1,hotReload=True)
21+
itchat.run(debug=True)

0 commit comments

Comments
 (0)