@authorization_required(is_admin=True)
    @threaded
    def post(self):
        try:
            login = self.json["login"]
            email = self.json["email"]
            is_admin = bool(self.json.get("is_admin", 0))
            password = self.json["password"]

            assert password and len(password) > 3
            assert LOGIN_EXP.match(login)
            assert EMAIL_EXP.match(email)
        except (__HOLE__, AssertionError, TypeError):
            raise HTTPError(400)

        if Users.select().where(Users.login == login).count():
            raise HTTPError(409)

        user = Users(
            login=login,
            email=email,
            is_admin=is_admin,
            password=password,
        )

        user.save()

        self.response({
            'id': user.id,
            'login': user.login,
            'email': user.email,
            'is_admin': user.is_admin,
        })
dataset/ETHPy150Open mosquito/pypi-server/pypi_server/handlers/api/users.py/UsersHandler.post