Skip to content

send_test_event_notification

send_test_event_notification(
    notification: NotificationSpecification,
    test_event_type: EventType,
    *,
    config_overrides: Optional[MTurkClientConfig] = None,
) -> SendTestEventNotificationResponse

The SendTestEventNotification operation causes Amazon Mechanical Turk to send a notification message as if a HIT event occurred, according to the provided notification specification. This allows you to test notifications without setting up notifications for a real HIT type and trying to trigger them using the website. When you call this operation, the service attempts to send the test notification immediately.

Parameters:

  • notification (NotificationSpecification) –

    The notification specification to test. This value is identical to the value you would provide to the UpdateNotificationSettings operation when you establish the notification specification for a HIT type.

  • test_event_type (EventType) –

    The event to simulate to test the notification specification. This event is included in the test message even if the notification specification does not include the event type. The notification specification does not filter out the test event.

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 send_test_event_notification(
    self,
    notification: "capo_mturk.types.notification_specification.NotificationSpecification",
    test_event_type: "capo_mturk.types.event_type.EventType",
    *,
    config_overrides: Optional[MTurkClientConfig] = None,
) -> "capo_mturk.types.send_test_event_notification_response.SendTestEventNotificationResponse":
    """<p> The <code>SendTestEventNotification</code> operation causes Amazon Mechanical Turk to send a notification message as if a HIT event occurred, according to the provided notification specification. This allows you to test notifications without setting up notifications for a real HIT type and trying to trigger them using the website. When you call this operation, the service attempts to send the test notification immediately. </p>

    Args:
        notification: <p> The notification specification to test. This value is identical to the value you would provide to the UpdateNotificationSettings operation when you establish the notification specification for a HIT type. </p>
        test_event_type: <p> The event to simulate to test the notification specification. This event is included in the test message even if the notification specification does not include the event type. The notification specification does not filter out the test event. </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.send_test_event_notification_request.SendTestEventNotificationRequest]",
    ) -> OperationResponse[
        "capo_mturk.types.send_test_event_notification_response.SendTestEventNotificationResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.send_test_event_notification

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SendTestEventNotification")
    )
    input_: capo_mturk.types.send_test_event_notification_request.SendTestEventNotificationRequest = {
        "notification": notification,
        "test_event_type": test_event_type,
    }

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