import hashlib
@main.route('/')
def index():
    wxtoken = '5tgb6yhn7ujm'
    signature = request.args.get('signature')
    timestamp = request.args.get('timestamp')
    nonce = request.args.get("nonce");
    tmparr = [wxtoken, timestamp, nonce]
    tmparr.sort()
    tmpstr = ''.join(tmparr)
    tmpstr = hashlib.sha1(tmpstr).hexdigest()
    if tmpstr == signature:
        return request.args.get('echostr')
    else:
        return ''
09-13 01:47