views.py 文件源码

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

项目:Pyphon 作者: pyphonic 项目源码 文件源码
def post(self, request, *kwargs):
        parser = FormParser()
        query_dict = parser.parse(request)
        contact = Contact.objects.filter(number=query_dict["From"]).first()
        if not contact:
            contact = Contact(number=query_dict["From"])
            contact.save()
        if contact.number != os.environ["TWILIO_NUMBER"]:
            sender = "them"
        else:
            sender = "you"
        text = Text(sender=sender, contact=contact, body=query_dict["Body"])
        text.save()
        return HttpResponse()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号