@threaded
    def post(self):
        try:
            login, password = self.json['login'], self.json['password']
        except __HOLE__:
            raise HTTPError(400)

        try:
            user = Users.check(login, password)
        except DoesNotExist:
            raise HTTPError(403)

        self.set_secure_cookie(
            'session',
            (
                user.id,
                self.request.remote_ip,
                IOLoop.current().time()
            ),
            SESSION_DAYS
        )

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