def create_question(participant_id):
    """Send a POST request to the question table.

    Questions store information at the participant level, not the node
    level.
    You should pass the question (string) number (int) and response
    (string) as arguments.
    """
    # 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)

    # Make sure the participant status is "working"
    if ppt.status != "working":
        error_type = "/question POST, status = {}".format(ppt.status)
        return error_response(error_type=error_type,
                              participant=ppt)

    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 type(x) == Response:
            return x

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

    # return the data
    return success_response(request_type="question post")
def create_question ( participant_id ) : 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 ) if ppt . status != "working" : error_type = "/question POST, status = {}" . format ( ppt . status ) return error_response ( error_type = error_type , participant = ppt ) 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 type ( x ) == Response : return x try : models . Question ( participant = ppt , question = question , response = response , number = number ) session . commit ( ) except : return error_response ( error_type = "/question POST server error" , status = 403 ) return success_response ( request_type = "question post" )
Send a POST request to the question table.

    Questions store information at the participant level, not the node
    level.
    You should pass the question (string) number (int) and response
    (string) as arguments.