1. 配置wexin, 开启tornado 服务器linux
code ser:服务器
WECHAT_TOKEN = "hyhlinux"微信
class WeChatHandler(RequestHandler):tornado
def get(self):
signature = self.get_argument('signature') #get发过来的,咱们须要验证是微信
timestamp = self.get_argument('timestamp') #1.时间戳
nonce = self.get_argument('nonce') #
echostr = self.get_argument('echostr') code
tmp = [WECHAT_TOKEN, timestamp, nonce]
tmp.sort()
tmp_str = "".join(tmp)
tmp_str = hashlib.sha1(tmp_str).hexdigest()get
if (tmp_str == signature):
print('wechat 200')
self.write(echostr)
else:
# 403 倍禁止
print('wechat 403')
self.send_err(403)hash
点击提交后:it
ser: 成功被调用,同时sigclass
weixin:配置
2.