views.py 文件源码

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

项目:Domain-Expiration 作者: Palen 项目源码 文件源码
def _post_(self, request):
        data = await request.post()
        domain = data.get('domain', "")
        domain_expiration = DomainExpiration(domain=domain)

        if not domain_expiration.name:
            response = {"response": "KO", "message": self.EMPTY_DOMAIN}
        elif not domain_expiration.allowed:
            response = {"response": "KO", "message": self.ALLOWED}

        elif self.db.domains.find_one({"name": domain_expiration.name}):
            response = {"response": "KO", "message": self.EXISTS}

        else:
            domain_expiration.save()
            response = {"response": "OK"}

        return web.json_response(response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号