Skip to content

create_qualification_type async

create_qualification_type(
    name: String,
    description: String,
    qualification_type_status: QualificationTypeStatus,
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
    keywords: Optional[String] = None,
    retry_delay_in_seconds: Optional[Long] = None,
    test: Optional[String] = None,
    answer_key: Optional[String] = None,
    test_duration_in_seconds: Optional[Long] = None,
    auto_granted: Optional[Boolean] = None,
    auto_granted_value: Optional[Integer] = None,
) -> CreateQualificationTypeResponse

The CreateQualificationType operation creates a new Qualification type, which is represented by a QualificationType data structure.

Parameters:

  • name (String) –

    The name you give to the Qualification type. The type name is used to represent the Qualification to Workers, and to find the type using a Qualification type search. It must be unique across all of your Qualification types.

  • keywords (Optional[String], default: None ) –

    One or more words or phrases that describe the Qualification type, separated by commas. The keywords of a type make the type easier to find during a search.

  • description (String) –

    A long description for the Qualification type. On the Amazon Mechanical Turk website, the long description is displayed when a Worker examines a Qualification type.

  • qualification_type_status (QualificationTypeStatus) –

    The initial status of the Qualification type.

    Constraints: Valid values are: Active | Inactive

  • retry_delay_in_seconds (Optional[Long], default: None ) –

    The number of seconds that a Worker must wait after requesting a Qualification of the Qualification type before the worker can retry the Qualification request.

    Constraints: None. If not specified, retries are disabled and Workers can request a Qualification of this type only once, even if the Worker has not been granted the Qualification. It is not possible to disable retries for a Qualification type after it has been created with retries enabled. If you want to disable retries, you must delete existing retry-enabled Qualification type and then create a new Qualification type with retries disabled.

  • test (Optional[String], default: None ) –

    The questions for the Qualification test a Worker must answer correctly to obtain a Qualification of this type. If this parameter is specified, TestDurationInSeconds must also be specified.

    Constraints: Must not be longer than 65535 bytes. Must be a QuestionForm data structure. This parameter cannot be specified if AutoGranted is true.

    Constraints: None. If not specified, the Worker may request the Qualification without answering any questions.

  • answer_key (Optional[String], default: None ) –

    The answers to the Qualification test specified in the Test parameter, in the form of an AnswerKey data structure.

    Constraints: Must not be longer than 65535 bytes.

    Constraints: None. If not specified, you must process Qualification requests manually.

  • test_duration_in_seconds (Optional[Long], default: None ) –

    The number of seconds the Worker has to complete the Qualification test, starting from the time the Worker requests the Qualification.

  • auto_granted (Optional[Boolean], default: None ) –

    Specifies whether requests for the Qualification type are granted immediately, without prompting the Worker with a Qualification test.

    Constraints: If the Test parameter is specified, this parameter cannot be true.

  • auto_granted_value (Optional[Integer], default: None ) –

    The Qualification value to use for automatically granted Qualifications. This parameter is used only if the AutoGranted parameter is true.

Raises:

  • RequestError –

    Your request is invalid.

  • ServiceFault –

    Amazon Mechanical Turk is temporarily unable to process your request. Try your call again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_mturk/_services/async_m_turk.py
async def create_qualification_type(
    self,
    name: "capo_mturk.types.string.String",
    description: "capo_mturk.types.string.String",
    qualification_type_status: "capo_mturk.types.qualification_type_status.QualificationTypeStatus",
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
    keywords: Optional["capo_mturk.types.string.String"] = None,
    retry_delay_in_seconds: Optional["capo_mturk.types.long.Long"] = None,
    test: Optional["capo_mturk.types.string.String"] = None,
    answer_key: Optional["capo_mturk.types.string.String"] = None,
    test_duration_in_seconds: Optional["capo_mturk.types.long.Long"] = None,
    auto_granted: Optional["capo_mturk.types.boolean.Boolean"] = None,
    auto_granted_value: Optional["capo_mturk.types.integer.Integer"] = None,
) -> "capo_mturk.types.create_qualification_type_response.CreateQualificationTypeResponse":
    """<p> The <code>CreateQualificationType</code> operation creates a new Qualification type, which is represented by a <code>QualificationType</code> data structure. </p>

    Args:
        name: <p> The name you give to the Qualification type. The type name is used to represent the Qualification to Workers, and to find the type using a Qualification type search. It must be unique across all of your Qualification types.</p>
        keywords: <p>One or more words or phrases that describe the Qualification type, separated by commas. The keywords of a type make the type easier to find during a search.</p>
        description: <p>A long description for the Qualification type. On the Amazon Mechanical Turk website, the long description is displayed when a Worker examines a Qualification type.</p>
        qualification_type_status: <p>The initial status of the Qualification type.</p> <p>Constraints: Valid values are: Active | Inactive</p>
        retry_delay_in_seconds: <p>The number of seconds that a Worker must wait after requesting a Qualification of the Qualification type before the worker can retry the Qualification request.</p> <p>Constraints: None. If not specified, retries are disabled and Workers can request a Qualification of this type only once, even if the Worker has not been granted the Qualification. It is not possible to disable retries for a Qualification type after it has been created with retries enabled. If you want to disable retries, you must delete existing retry-enabled Qualification type and then create a new Qualification type with retries disabled.</p>
        test: <p> The questions for the Qualification test a Worker must answer correctly to obtain a Qualification of this type. If this parameter is specified, <code>TestDurationInSeconds</code> must also be specified. </p> <p>Constraints: Must not be longer than 65535 bytes. Must be a QuestionForm data structure. This parameter cannot be specified if AutoGranted is true.</p> <p>Constraints: None. If not specified, the Worker may request the Qualification without answering any questions.</p>
        answer_key: <p>The answers to the Qualification test specified in the Test parameter, in the form of an AnswerKey data structure.</p> <p>Constraints: Must not be longer than 65535 bytes.</p> <p>Constraints: None. If not specified, you must process Qualification requests manually.</p>
        test_duration_in_seconds: <p>The number of seconds the Worker has to complete the Qualification test, starting from the time the Worker requests the Qualification.</p>
        auto_granted: <p>Specifies whether requests for the Qualification type are granted immediately, without prompting the Worker with a Qualification test.</p> <p>Constraints: If the Test parameter is specified, this parameter cannot be true.</p>
        auto_granted_value: <p>The Qualification value to use for automatically granted Qualifications. This parameter is used only if the AutoGranted parameter is true.</p>

    Raises:
        capo_mturk.errors.request_error.RequestError: <p>Your request is invalid.</p>
        capo_mturk.errors.service_fault.ServiceFault: <p>Amazon Mechanical Turk is temporarily unable to process your request. Try your call again.</p>
        capo_mturk.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_mturk.types.create_qualification_type_request.CreateQualificationTypeRequest]",
    ) -> AsyncOperationResponse[
        "capo_mturk.types.create_qualification_type_response.CreateQualificationTypeResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.create_qualification_type

        (
            output,
            http_response,
        ) = await capo_mturk._operations.m_turk_requester_service_v20170117.create_qualification_type.async_create_qualification_type(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateQualificationType")
    )
    input_: capo_mturk.types.create_qualification_type_request.CreateQualificationTypeRequest = {
        "name": name,
        "description": description,
        "qualification_type_status": qualification_type_status,
    }
    if keywords is not None:
        input_["keywords"] = keywords
    if retry_delay_in_seconds is not None:
        input_["retry_delay_in_seconds"] = retry_delay_in_seconds
    if test is not None:
        input_["test"] = test
    if answer_key is not None:
        input_["answer_key"] = answer_key
    if test_duration_in_seconds is not None:
        input_["test_duration_in_seconds"] = test_duration_in_seconds
    if auto_granted is not None:
        input_["auto_granted"] = auto_granted
    if auto_granted_value is not None:
        input_["auto_granted_value"] = auto_granted_value

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output