Skip to content

list_assignments_for_hit

list_assignments_for_hit(
    hit_id: EntityId,
    *,
    config_overrides: Optional[MTurkClientConfig] = None,
    next_token: Optional[PaginationToken] = None,
    max_results: Optional[ResultSize] = None,
    assignment_statuses: Optional[AssignmentStatusList] = None,
) -> ListAssignmentsForHITResponse

The ListAssignmentsForHIT operation retrieves completed assignments for a HIT. You can use this operation to retrieve the results for a HIT.

You can get assignments for a HIT at any time, even if the HIT is not yet Reviewable. If a HIT requested multiple assignments, and has received some results but has not yet become Reviewable, you can still retrieve the partial results with this operation.

Use the AssignmentStatus parameter to control which set of assignments for a HIT are returned. The ListAssignmentsForHIT operation can return submitted assignments awaiting approval, or it can return assignments that have already been approved or rejected. You can set AssignmentStatus=Approved,Rejected to get assignments that have already been approved and rejected together in one result set.

Only the Requester who created the HIT can retrieve the assignments for that HIT.

Results are sorted and divided into numbered pages and the operation returns a single page of results. You can use the parameters of the operation to control sorting and pagination.

Parameters:

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/m_turk.py
def list_assignments_for_hit(
    self,
    hit_id: "capo_mturk.types.entity_id.EntityId",
    *,
    config_overrides: Optional[MTurkClientConfig] = None,
    next_token: Optional[
        "capo_mturk.types.pagination_token.PaginationToken"
    ] = None,
    max_results: Optional["capo_mturk.types.result_size.ResultSize"] = None,
    assignment_statuses: Optional[
        "capo_mturk.types.assignment_status_list.AssignmentStatusList"
    ] = None,
) -> "capo_mturk.types.list_assignments_for_hit_response.ListAssignmentsForHITResponse":
    """<p> The <code>ListAssignmentsForHIT</code> operation retrieves completed assignments for a HIT. You can use this operation to retrieve the results for a HIT. </p> <p> You can get assignments for a HIT at any time, even if the HIT is not yet Reviewable. If a HIT requested multiple assignments, and has received some results but has not yet become Reviewable, you can still retrieve the partial results with this operation. </p> <p> Use the AssignmentStatus parameter to control which set of assignments for a HIT are returned. The ListAssignmentsForHIT operation can return submitted assignments awaiting approval, or it can return assignments that have already been approved or rejected. You can set AssignmentStatus=Approved,Rejected to get assignments that have already been approved and rejected together in one result set. </p> <p> Only the Requester who created the HIT can retrieve the assignments for that HIT. </p> <p> Results are sorted and divided into numbered pages and the operation returns a single page of results. You can use the parameters of the operation to control sorting and pagination. </p>

    Args:
        hit_id: <p>The ID of the HIT.</p>
        next_token: <p>Pagination token</p>
        assignment_statuses: <p>The status of the assignments to return: Submitted | Approved | Rejected</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.
    """

    def _handler(
        req: "OperationRequest[capo_mturk.types.list_assignments_for_hit_request.ListAssignmentsForHITRequest]",
    ) -> OperationResponse[
        "capo_mturk.types.list_assignments_for_hit_response.ListAssignmentsForHITResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.list_assignments_for_hit

        output, http_response = (
            capo_mturk._operations.m_turk_requester_service_v20170117.list_assignments_for_hit.list_assignments_for_hit(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAssignmentsForHIT")
    )
    input_: capo_mturk.types.list_assignments_for_hit_request.ListAssignmentsForHITRequest = {
        "hit_id": hit_id
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if assignment_statuses is not None:
        input_["assignment_statuses"] = assignment_statuses

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output