首页 > 微信 > 详细

微信后台服务器地址验证的逻辑

时间:2018-03-04 12:17:10      阅读:237      评论:0      收藏:0      [点我收藏+]

不说废话了,直接上py3 django代码:

    token = "-----------------------------"#自己填到微信设置里面的token
    nonce = request.GET["nonce"]
    timestamp = request.GET["timestamp"]
    msg_sign = request.GET["signature"]
    arr1 = [token,timestamp,nonce]
    arr1.sort()
    tempstr = "".join(arr1)
    sha1 = hashlib.sha1()
    sha1.update(tempstr.encode(utf-8))
    compute_sign = sha1.hexdigest()
    if msg_sign == compute_sign:
        return HttpResponse(request.GET["echostr"])

 

微信后台服务器地址验证的逻辑

原文:https://www.cnblogs.com/dhcn/p/8504295.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!