Gets the question.

        return: (osid.assessment.Question) - the question
        raise:  OperationFailed - unable to complete request
        *compliance: mandatory -- This method must be implemented.*
973191
def get_question(self):
        
        question_map = dict(self._my_map['question'])
        question_map['learningObjectiveIds'] = self._my_map['learningObjectiveIds']
        return Question(osid_object_map=question_map,
                        runtime=self._runtime,
                        proxy=self._proxy)
174332
def is_question_valid(self):
        
        if self.question_upload_type == STRING:
            return self.question_answer_string and True
        else:
            return self.question_upload_file and self.question_checker_script
1103114
def request(operation, version = nil, params = {})
      response = open(request_url(operation, version, params), @http_opts) do |f|
        @raw_response = f.read
        JSON.parse(@raw_response)
      end
      unless response['Header']['Status'] == 'Success'
        raise ApiError.new(response['Header']['Status'], response['Header']['StatusMsg']) 
      end
      extract_result(response, operation)
    end
996467
def _get_error_response(self, exc):
        
        if exc.has_code(codes.UNAUTHORIZED):
            return self._get_auth_challenge(exc)
        else:
            if exc.has_code(codes.INTERNAL_SERVER_ERROR):
                logging.getLogger('devil').error('devil caught http error: ' + str(exc), exc_info=True)
            else:
                logging.getLogger('devil').error('devil caught http error: ' + str(exc))
            content = exc.content or ''
            return HttpResponse(content=content, status=exc.get_code_num())
423607
def _request_api(self, **kwargs):
        
        _url = kwargs.get('url')
        _method = kwargs.get('method', 'GET')
        _status = kwargs.get('status', 200)

        counter = 0
        if _method not in ['GET', 'POST']:
            raise ValueError('Method is not GET or POST')

        while True:
            try:
                res = REQ[_method](_url, cookies=self._cookie)
                if res.status_code == _status:
                    break
                else:
                    raise BadStatusException(res.content)
            except requests.exceptions.BaseHTTPError:
                if counter < self._retries:
                    counter += 1
                    continue
                raise MaxRetryError
        self._last_result = res
        return res
108402
def get(self, uri):
        
        r = None
        
        try:
            r = requests.get(uri,
                             allow_redirects=True,
                             timeout=Settings.requests_timeout,
                             headers={},
                             auth=HTTPDigestAuth(self.user, self.password))
            return self.answer(r.status_code, r.json())
        except:
            raise
        finally:
            if r:
                r.connection.close()
926246
def questions(self):
        
        self._make_soup()
        # noinspection PyTypeChecker
        for question in self._page_get_questions(self.soup):
            yield question
        i = 2
        while True:
            soup = BeautifulSoup(self._session.get(
                self.url[:-1] + '?page=' + str(i)).text)
            for question in self._page_get_questions(soup):
                if question == 0:
                    return
                yield question
            i += 1
525166
def error(rcode:, question:nil)
      question = question || @questions[0]

      return Packet.new(
        trn_id: @trn_id,
        qr: QR_RESPONSE,
        opcode: OPCODE_QUERY,
        flags: FLAG_RD | FLAG_RA,
        rcode: rcode,
        questions: [question],
        answers: [],
      )
    end
40455
def create_callback(self):
        
        def __callback(question_posed):
            logger.debug("%s: asked to choose between: %s" % (self._name, self._qstr(question_posed)))
            if self._upto == len(self._data):
                logger.error("%s: out of automation data, requested to pick between %s" % (self._name, self._qstr(question_posed)))
                raise AutomationException("out of automation data")
            question_archived, answer = self._data[self._upto]
            if question_archived != question_posed:
                logger.error("%s: automation data mismatch, expected question `%s', got question `%s'" % (self._name, self._qstr(question_archived), self._qstr(question_posed)))
            resp = question_posed.index(answer)
            self._upto += 1
            return resp
        return __callback
1220984
def ask_questions(self):
        
        out_config = {}

        for key in c.CONFIG_QUESTIONS:
            section = key[1]
            print
            for question in section:
                answer = utils.ask(question[1], question[2])
                out_config["{0}_{1}".format(key[0], question[0])] = answer

        for key in c.CONFIG_MULTIPLE_CHOICE_QUESTIONS:
            section = key[1]
            print
            # keep going until we get what we want
            while True:
                input = utils.ask(section[1], "")
                if (input.isdigit() and
                        int(input) > 0 and
                        int(input) <= section[0]):
                    answer = input

                    break
                print

            # store the answer as 1 less than it is, we're dealing with
            # a list to select the number which is 0 indexed
            answer = int(input) - 1

            if key[0] == "license":
                out_config["license_type"] = c.LICENSE_TYPES[answer][0]
                out_config["license_url"] = c.LICENSE_TYPES[answer][1]

        # merge in defaults without asking questions
        merged_config = dict(c.CONFIG_DEFAULTS.items() + out_config.items())

        return merged_config
473459
def create_question(participant_id):
    
    # Get the participant.
    try:
        ppt = models.Participant.query.filter_by(id=participant_id).one()
    except NoResultFound:
        return error_response(
            error_type="/question POST no participant found", status=403
        )

    question = request_parameter(parameter="question")
    response = request_parameter(parameter="response")
    number = request_parameter(parameter="number", parameter_type="int")
    for x in [question, response, number]:
        if isinstance(x, Response):
            return x

    # Consult the recruiter regarding whether to accept a questionnaire
    # from the participant:
    rejection = ppt.recruiter.rejects_questionnaire_from(ppt)
    if rejection:
        return error_response(
            error_type="/question POST, status = {}, reason: {}".format(
                ppt.status, rejection
            ),
            participant=ppt,
        )

    try:
        # execute the request
        models.Question(
            participant=ppt, question=question, response=response, number=number
        )
        session.commit()
    except Exception:
        return error_response(error_type="/question POST server error", status=403)

    # return the data
    return success_response()
1248687
def get(self):
        
        self.log.info('starting the ``get`` method')

        unit_conversion = None

        self.log.info('completed the ``get`` method')
        return unit_conversion
1216587
def get(self):
        
        try:
            self._measurementController.reloadCompletedMeasurements()
            return None, 200
        except:
            logger.exception("Failed to reload measurements")
            return str(sys.exc_info()), 500
36305
def get(self):
        
        response, instance = self.request("GET", self.uri)
        return self.load_instance(instance)
1301156
def question_fetchable(self, **kwargs):
        
        return util.Fetchable(QuestionFetcher(
            self._session, self.username,
            is_user=self.is_logged_in_user, **kwargs
        ))
1125525
def ask(question, default=None):
    
    question = str(question)

    if default:
        question += ' [' + str(default) + ']'

    question += ': '

    reply = raw_input(question)
    return reply if reply else default
553550
def get(self, command=None):
        

        try:
            assert self.telnet
            with self.lock:
                if command:
                    if not command.endswith('\r\n'):
                        command += '\r\n'
                    LOGGER.debug('%s: sending %r', self.host, command)
                    self.telnet.write(command.encode())

                res = self.telnet.read_until('\r\n'.encode()).decode()
                LOGGER.debug('%s: received %r', self.host, res)
                if res.split()[0] not in ('100', '250'):
                    LOGGER.warn('command error: %r', res)
                    return None
                return res.split()[1]

        except (AssertionError):
            self.connect()

        except (EOFError, socket.gaierror, BrokenPipeError):
            LOGGER.error("Cannot get answer from %s (%d)",
                         self.host, self.retries)
            if self.retries > 0:
                self.retries -= 1
                self.connect()
                return self.get(command)
            else:
                self.retries = Netio.MAX_RETRIES
                return None