微博开启开发者中心——python代码

来源:互联网 发布:网络备课的好处 编辑:程序博客网 时间:2024/06/02 16:25


需要申请新浪app,得到app secret。


开发环境:Flask + sae



@app.route('/weibo/', methods=['GET', 'POST'])def weibo_auth():    if request.method == 'GET':        token = '***' // your app secret    query = request.args    signature = query.get('signature', '')    timestamp = query.get('timestamp', '')    nonce = query.get('nonce', '')    echostr = query.get('echostr', '')    s = [timestamp, nonce, token]    s.sort()    s = ''.join(s)    if hashlib.sha1(s).hexdigest() == signature:        return make_response(echostr)


0 0
原创粉丝点击