Skip to content

reject_assignment async

reject_assignment(
    assignment_id: EntityId,
    requester_feedback: String,
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
) -> RejectAssignmentResponse

The RejectAssignment operation rejects the results of a completed assignment.

You can include an optional feedback message with the rejection, which the Worker can see in the Status section of the web site. When you include a feedback message with the rejection, it helps the Worker understand why the assignment was rejected, and can improve the quality of the results the Worker submits in the future.

Only the Requester who created the HIT can reject an assignment for the HIT.

Parameters:

  • assignment_id (EntityId) –

    The ID of the assignment. The assignment must correspond to a HIT created by the Requester.

  • requester_feedback (String) –

    A message for the Worker, which the Worker can see in the Status section of the web site.

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 reject_assignment(
    self,
    assignment_id: "capo_mturk.types.entity_id.EntityId",
    requester_feedback: "capo_mturk.types.string.String",
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
) -> "capo_mturk.types.reject_assignment_response.RejectAssignmentResponse":
    """<p> The <code>RejectAssignment</code> operation rejects the results of a completed assignment. </p> <p> You can include an optional feedback message with the rejection, which the Worker can see in the Status section of the web site. When you include a feedback message with the rejection, it helps the Worker understand why the assignment was rejected, and can improve the quality of the results the Worker submits in the future. </p> <p> Only the Requester who created the HIT can reject an assignment for the HIT. </p>

    Args:
        assignment_id: <p> The ID of the assignment. The assignment must correspond to a HIT created by the Requester. </p>
        requester_feedback: <p> A message for the Worker, which the Worker can see in the Status section of the web site. </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.reject_assignment_request.RejectAssignmentRequest]",
    ) -> AsyncOperationResponse[
        "capo_mturk.types.reject_assignment_response.RejectAssignmentResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.reject_assignment

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RejectAssignment")
    )
    input_: capo_mturk.types.reject_assignment_request.RejectAssignmentRequest = {
        "assignment_id": assignment_id,
        "requester_feedback": requester_feedback,
    }

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