Skip to content

update_notification_settings async

update_notification_settings(
    hit_type_id: EntityId,
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
    notification: Optional[NotificationSpecification] = None,
    active: Optional[Boolean] = None,
) -> UpdateNotificationSettingsResponse

The UpdateNotificationSettings operation creates, updates, disables or re-enables notifications for a HIT type. If you call the UpdateNotificationSettings operation for a HIT type that already has a notification specification, the operation replaces the old specification with a new one. You can call the UpdateNotificationSettings operation to enable or disable notifications for the HIT type, without having to modify the notification specification itself by providing updates to the Active status without specifying a new notification specification. To change the Active status of a HIT type's notifications, the HIT type must already have a notification specification, or one must be provided in the same call to UpdateNotificationSettings.

Parameters:

  • hit_type_id (EntityId) –

    The ID of the HIT type whose notification specification is being updated.

  • notification (Optional[NotificationSpecification], default: None ) –

    The notification specification for the HIT type.

  • active (Optional[Boolean], default: None ) –

    Specifies whether notifications are sent for HITs of this HIT type, according to the notification specification. You must specify either the Notification parameter or the Active parameter for the call to UpdateNotificationSettings to succeed.

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_notification_settings(
    self,
    hit_type_id: "capo_mturk.types.entity_id.EntityId",
    *,
    config_overrides: Optional[AsyncMTurkClientConfig] = None,
    notification: Optional[
        "capo_mturk.types.notification_specification.NotificationSpecification"
    ] = None,
    active: Optional["capo_mturk.types.boolean.Boolean"] = None,
) -> "capo_mturk.types.update_notification_settings_response.UpdateNotificationSettingsResponse":
    """<p> The <code>UpdateNotificationSettings</code> operation creates, updates, disables or re-enables notifications for a HIT type. If you call the UpdateNotificationSettings operation for a HIT type that already has a notification specification, the operation replaces the old specification with a new one. You can call the UpdateNotificationSettings operation to enable or disable notifications for the HIT type, without having to modify the notification specification itself by providing updates to the Active status without specifying a new notification specification. To change the Active status of a HIT type's notifications, the HIT type must already have a notification specification, or one must be provided in the same call to <code>UpdateNotificationSettings</code>. </p>

    Args:
        hit_type_id: <p> The ID of the HIT type whose notification specification is being updated. </p>
        notification: <p> The notification specification for the HIT type. </p>
        active: <p> Specifies whether notifications are sent for HITs of this HIT type, according to the notification specification. You must specify either the Notification parameter or the Active parameter for the call to UpdateNotificationSettings to succeed. </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_notification_settings_request.UpdateNotificationSettingsRequest]",
    ) -> AsyncOperationResponse[
        "capo_mturk.types.update_notification_settings_response.UpdateNotificationSettingsResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.update_notification_settings

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateNotificationSettings")
    )
    input_: capo_mturk.types.update_notification_settings_request.UpdateNotificationSettingsRequest = {
        "hit_type_id": hit_type_id
    }
    if notification is not None:
        input_["notification"] = notification
    if active is not None:
        input_["active"] = active

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