Skip to content

update_expiration_for_hit async

update_expiration_for_hit(
    hit_id: EntityId,
    expire_at: Timestamp,
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
) -> UpdateExpirationForHITResponse

The UpdateExpirationForHIT operation allows you update the expiration time of a HIT. If you update it to a time in the past, the HIT will be immediately expired.

Parameters:

  • hit_id (EntityId) –

    The HIT to update.

  • expire_at (Timestamp) –

    The date and time at which you want the HIT to expire

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 update_expiration_for_hit(
    self,
    hit_id: "capo_mturk.types.entity_id.EntityId",
    expire_at: "capo_mturk.types.timestamp.Timestamp",
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
) -> "capo_mturk.types.update_expiration_for_hit_response.UpdateExpirationForHITResponse":
    """<p> The <code>UpdateExpirationForHIT</code> operation allows you update the expiration time of a HIT. If you update it to a time in the past, the HIT will be immediately expired. </p>

    Args:
        hit_id: <p> The HIT to update. </p>
        expire_at: <p> The date and time at which you want the HIT to expire </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.update_expiration_for_hit_request.UpdateExpirationForHITRequest]",
    ) -> AsyncOperationResponse[
        "capo_mturk.types.update_expiration_for_hit_response.UpdateExpirationForHITResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.update_expiration_for_hit

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateExpirationForHIT")
    )
    input_: capo_mturk.types.update_expiration_for_hit_request.UpdateExpirationForHITRequest = {
        "hit_id": hit_id,
        "expire_at": expire_at,
    }

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