api.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:iris 作者: linkedin 项目源码 文件源码
def on_post(self, req, resp):
        post_dict = parse_qs(req.context['body'])

        msg_id = req.get_param('message_id', required=True)
        if 'Digits' not in post_dict:
            raise HTTPBadRequest('Digits argument not found')
        # For phone call callbacks, To argument is the target and From is the
        # twilio number
        if 'To' not in post_dict:
            raise HTTPBadRequest('To argument not found')
        digits = post_dict['Digits'][0]
        source = post_dict['To'][0]

        try:
            _, response = self.handle_user_response('call', msg_id, source, digits)
        except Exception:
            logger.exception('Failed to handle call response: %s' % digits)
            raise
        else:
            resp.status = HTTP_200
            resp.body = ujson.dumps({'app_response': response})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号