def on_post(self, req, resp):
"""
Accept twilio SMS webhook and forward to iris API
"""
try:
path = self.config['iris']['hook']['twilio_messages']
re = self.iclient.post(path, req.context['body'], raw=True)
except MaxRetryError as e:
logger.error(e.reason)
self.return_twixml_message('Connection error to web hook.', resp)
return
if re.status is not 200:
self.return_twixml_message(
'Got status code: %d, content: %s' % (re.status,
re.data[0:100]), resp)
return
else:
body = process_api_response(re.data)
self.return_twixml_message(body, resp)
return
评论列表
文章目录