def process_get(request): signature = request.GET['signature'] timestamp = request.GET['timestamp'] nonce = request.GET['nonce'] echostr = request.GET['echostr'] if validate.is_weixin_serve(signature, timestamp, nonce): return HttpResponse(echostr) return HttpResponse("False")
def process_post(request): signature = request.GET['signature'] timestamp = request.GET['timestamp'] nonce = request.GET['nonce'] if not validate.is_weixin_serve(signature, timestamp, nonce): return HttpResponse("False") xml_data = ElementTree.fromstring(request.body) return HttpResponse(reply.process_reply(xml_data))