def get(self, exp_id):
        """ Get all the (manually) logged data.

        +--------------------------------------------------------------------+
        | Example                                                            |
        +====================================================================+
        | http://example.com/stats/EXP_ID/log?limit=10                       |
        +--------------------------------------------------------------------+

        :requires: A secure cookie, obtained by logging in.
        :param int exp_id: The experiment ID for the logs that are to be retrieved.
        :param int limit (optional): Set an optional limit to the amount of logs returned.
        :returns: A list of JSONs of the logs.
        :raises 401: If the experiment does not belong to this user or the exp_id is wrong.
        :raises 401: If user is not logged in or if there is no secure cookie available.
        """
        if self.get_current_user():
            if self.validate_user_experiment(exp_id):
                limit = int(self.get_argument("limit", default=0))
                exp = Experiment(exp_id)
                response = exp.get_log_data(limit=limit)
                self.write(json.dumps(response))
            else:
                raise ExceptionHandler(
                    reason="Experiment could not be validated.",
                    status_code=401)
        else:
            raise ExceptionHandler(reason="Could not validate user.",
                                   status_code=401)
Beispiel #2
0
    def get(self, exp_id):
        """ Get all the (manually) logged data for experiment exp_id.

        +--------------------------------------------------------------------+
        | Example                                                            |
        +====================================================================+
        | http://example.com/stats/1/getLog.json                             |
        +--------------------------------------------------------------------+

        :requires: A secure cookie, obtained by logging in.
        :param int exp_id: The experiment ID for the logs that are to be retrieved.
        :returns: A JSON of JSONs of the logs.
        :raises: AUTH_ERROR if there is no secure cookie available.
        """
        if self.get_secure_cookie("user"):
            exp = Experiment(exp_id)
            response = exp.get_log_data()
            self.write(json.dumps(response))
        else:
            self.write("AUTH_ERROR")
    def get(self, exp_id):
        """ Get all the (manually) logged data for experiment exp_id.

        +--------------------------------------------------------------------+
        | Example                                                            |
        +====================================================================+
        | http://example.com/stats/1/getLog.json                             |
        +--------------------------------------------------------------------+

        :requires: A secure cookie, obtained by logging in.
        :param int exp_id: The experiment ID for the logs that are to be retrieved.
        :returns: A JSON of JSONs of the logs.
        :raises: AUTH_ERROR if there is no secure cookie available.
        """
        if self.get_secure_cookie("user"):
            exp = Experiment(exp_id)
            response = exp.get_log_data()
            self.write(json.dumps(response))
        else:
            self.write("AUTH_ERROR")