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)
评论列表
文章目录