Skip to content

create_hit_type async

create_hit_type(
    assignment_duration_in_seconds: Long,
    reward: CurrencyAmount,
    title: String,
    description: String,
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
    auto_approval_delay_in_seconds: Optional[Long] = None,
    keywords: Optional[String] = None,
    qualification_requirements: Optional[QualificationRequirementList] = None,
) -> CreateHITTypeResponse

The CreateHITType operation creates a new HIT type. This operation allows you to define a standard set of HIT properties to use when creating HITs. If you register a HIT type with values that match an existing HIT type, the HIT type ID of the existing type will be returned.

Parameters:

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

    The number of seconds after an assignment for the HIT has been submitted, after which the assignment is considered Approved automatically unless the Requester explicitly rejects it.

  • assignment_duration_in_seconds (Long) –

    The amount of time, in seconds, that a Worker has to complete the HIT after accepting it. If a Worker does not complete the assignment within the specified duration, the assignment is considered abandoned. If the HIT is still active (that is, its lifetime has not elapsed), the assignment becomes available for other users to find and accept.

  • reward (CurrencyAmount) –

    The amount of money the Requester will pay a Worker for successfully completing the HIT.

  • title (String) –

    The title of the HIT. A title should be short and descriptive about the kind of task the HIT contains. On the Amazon Mechanical Turk web site, the HIT title appears in search results, and everywhere the HIT is mentioned.

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

    One or more words or phrases that describe the HIT, separated by commas. These words are used in searches to find HITs.

  • description (String) –

    A general description of the HIT. A description includes detailed information about the kind of task the HIT contains. On the Amazon Mechanical Turk web site, the HIT description appears in the expanded view of search results, and in the HIT and assignment screens. A good description gives the user enough information to evaluate the HIT before accepting it.

  • qualification_requirements (Optional[QualificationRequirementList], default: None ) –

    Conditions that a Worker's Qualifications must meet in order to accept the HIT. A HIT can have between zero and ten Qualification requirements. All requirements must be met in order for a Worker to accept the HIT. Additionally, other actions can be restricted using the ActionsGuarded field on each QualificationRequirement structure.

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_hit_type(
    self,
    assignment_duration_in_seconds: "capo_mturk.types.long.Long",
    reward: "capo_mturk.types.currency_amount.CurrencyAmount",
    title: "capo_mturk.types.string.String",
    description: "capo_mturk.types.string.String",
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
    auto_approval_delay_in_seconds: Optional["capo_mturk.types.long.Long"] = None,
    keywords: Optional["capo_mturk.types.string.String"] = None,
    qualification_requirements: Optional[
        "capo_mturk.types.qualification_requirement_list.QualificationRequirementList"
    ] = None,
) -> "capo_mturk.types.create_hit_type_response.CreateHITTypeResponse":
    """<p> The <code>CreateHITType</code> operation creates a new HIT type. This operation allows you to define a standard set of HIT properties to use when creating HITs. If you register a HIT type with values that match an existing HIT type, the HIT type ID of the existing type will be returned. </p>

    Args:
        auto_approval_delay_in_seconds: <p> The number of seconds after an assignment for the HIT has been submitted, after which the assignment is considered Approved automatically unless the Requester explicitly rejects it. </p>
        assignment_duration_in_seconds: <p> The amount of time, in seconds, that a Worker has to complete the HIT after accepting it. If a Worker does not complete the assignment within the specified duration, the assignment is considered abandoned. If the HIT is still active (that is, its lifetime has not elapsed), the assignment becomes available for other users to find and accept. </p>
        reward: <p> The amount of money the Requester will pay a Worker for successfully completing the HIT. </p>
        title: <p> The title of the HIT. A title should be short and descriptive about the kind of task the HIT contains. On the Amazon Mechanical Turk web site, the HIT title appears in search results, and everywhere the HIT is mentioned. </p>
        keywords: <p> One or more words or phrases that describe the HIT, separated by commas. These words are used in searches to find HITs. </p>
        description: <p> A general description of the HIT. A description includes detailed information about the kind of task the HIT contains. On the Amazon Mechanical Turk web site, the HIT description appears in the expanded view of search results, and in the HIT and assignment screens. A good description gives the user enough information to evaluate the HIT before accepting it. </p>
        qualification_requirements: <p> Conditions that a Worker's Qualifications must meet in order to accept the HIT. A HIT can have between zero and ten Qualification requirements. All requirements must be met in order for a Worker to accept the HIT. Additionally, other actions can be restricted using the <code>ActionsGuarded</code> field on each <code>QualificationRequirement</code> structure. </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_hit_type_request.CreateHITTypeRequest]",
    ) -> AsyncOperationResponse[
        "capo_mturk.types.create_hit_type_response.CreateHITTypeResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.create_hit_type

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateHITType")
    )
    input_: capo_mturk.types.create_hit_type_request.CreateHITTypeRequest = {
        "assignment_duration_in_seconds": assignment_duration_in_seconds,
        "reward": reward,
        "title": title,
        "description": description,
    }
    if auto_approval_delay_in_seconds is not None:
        input_["auto_approval_delay_in_seconds"] = auto_approval_delay_in_seconds
    if keywords is not None:
        input_["keywords"] = keywords
    if qualification_requirements is not None:
        input_["qualification_requirements"] = qualification_requirements

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