Example #1
0
File: wx.py Project: qq40660/wx
 def get(self):
     global token
     signature = self.request.get('signature')
     timestamp = self.request.get('timestamp')
     nonce = self.request.get('nonce')
     echostr = self.request.get('echostr')
     if checkSignure(token, timestamp, nonce, signature):
         logging.info("connection wx rebot success")
         self.response.write(echostr)
     else:
         logging.info("connection wx rebo fail")
         webapp2.abort(403)
Example #2
0
File: wx.py Project: qq40660/wx
 def post(self):
     global token
     _args = dict(
         token=token,
         timestamp=self.request.get('timestamp'),
         nonce=self.request.get('nonce'),
         signature=self.request.get('signature')
     )
     if not checkSignure(**_args):
         return webapp2.abort(403)
     message = parse_message(self.request.body)
     reply = generate_reply(message)
     self.response.content_type = 'application/xml'
     self.response.write(to_unicode(reply.to_xml()))