SAE 搭建微信公众平台

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

最近在玩微信公众账号,开发者模式需要验证,自己没有公网服务器,于是考虑通过免费的云服务器解决了

下面是通过新浪云SAE进行的微信公众平台开发者模式的验证方法。

index.wsgi

# coding: UTF-8import saeimport osimport webfrom weixinInterface import WeixinInterface urls = ( '/', 'Hello',    '/weixin','WeixinInterface'class Hello: def GET(self):  return ("你好, Sunboy_2050") app = web.application(urls, globals()).wsgifunc()application = sae.create_wsgi_app(app)

weixinInterface.py

#coding:UTF-8import hashlibimport webclass WeixinInterface:    def GET(self):                data = web.input()  # 获取输入参数        signature = data.signature        timestamp = data.timestamp        nonce = data.nonce        echostr = data.echostr                token="sunboy_2050"    # 自己的token                list=[token,timestamp,nonce] # 字典序排序        list.sort()                sha1=hashlib.sha1()    # sha1加密算法        map(sha1.update, list)        hashcode=sha1.hexdigest()                if hashcode == signature:  # 如果是来自微信的请求,则回复echostr            return echostr    # print "true"

运行结果:

在浏览器输入网址: http://weixin.ithomer.net



验证微信

成为微信公众平台开发者,需要进行验证,输入URL和Token

在SAE上,已经配置了Token(sunboy_2050),URL连接为 http://weixin.ithomer.net/weixin


点击“提交”按钮,自动进行验证,验证结果如下:



搭建的微信公众账号: ithomer




参考推荐:

利用SAE搭建微信公众平台

SAE Python环境SAE官方

微信开发者接入平台微信官方


           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/dghggij/article/details/84076890
sae
今日推荐