Skip to content

delete_worker_block async

delete_worker_block(
    worker_id: CustomerId,
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
    reason: Optional[String] = None,
) -> DeleteWorkerBlockResponse

The DeleteWorkerBlock operation allows you to reinstate a blocked Worker to work on your HITs. This operation reverses the effects of the CreateWorkerBlock operation. You need the Worker ID to use this operation. If the Worker ID is missing or invalid, this operation fails and returns the message “WorkerId is invalid.” If the specified Worker is not blocked, this operation returns successfully.

Parameters:

  • worker_id (CustomerId) –

    The ID of the Worker to unblock.

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

    A message that explains the reason for unblocking the Worker. The Worker does not see this message.

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 delete_worker_block(
    self,
    worker_id: "capo_mturk.types.customer_id.CustomerId",
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
    reason: Optional["capo_mturk.types.string.String"] = None,
) -> "capo_mturk.types.delete_worker_block_response.DeleteWorkerBlockResponse":
    """<p>The <code>DeleteWorkerBlock</code> operation allows you to reinstate a blocked Worker to work on your HITs. This operation reverses the effects of the CreateWorkerBlock operation. You need the Worker ID to use this operation. If the Worker ID is missing or invalid, this operation fails and returns the message “WorkerId is invalid.” If the specified Worker is not blocked, this operation returns successfully.</p>

    Args:
        worker_id: <p>The ID of the Worker to unblock.</p>
        reason: <p>A message that explains the reason for unblocking the Worker. The Worker does not see this message.</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.delete_worker_block_request.DeleteWorkerBlockRequest]",
    ) -> AsyncOperationResponse[
        "capo_mturk.types.delete_worker_block_response.DeleteWorkerBlockResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.delete_worker_block

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteWorkerBlock")
    )
    input_: capo_mturk.types.delete_worker_block_request.DeleteWorkerBlockRequest = {
        "worker_id": worker_id
    }
    if reason is not None:
        input_["reason"] = reason

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