服务器上的操作:
将下面的wx.py文件放在服务器上,运行python3 wx.py 80
# -*- coding: utf-8 -*-
# filename: main.py
import web
import handle
import hashlib
class WeChatHandler(object):
def GET(self):
data = web.input()
if len(data) == 0:
return "hello, this is handle view"
signature = data.signature
timestamp = data.timestamp
nonce = data.nonce
echostr = data.echostr
return int(echostr)
urls = (
'/wx', 'WeChatHandler',
)
if __name__ == '__main__':
app = web.application(urls, globals())
app.run()
公众号端配置:
点击提交即可