Skip to content

put_events async

put_events(
    tracking_id: StringType,
    session_id: StringType,
    event_list: EventList,
    *,
    config_overrides: Optional[AsyncPersonalizeEventsClientConfig] = None,
    user_id: Optional[UserId] = None,
) -> None

Records item interaction event data. For more information see Recording item interaction events.

Parameters:

  • tracking_id (StringType) –

    The tracking ID for the event. The ID is generated by a call to the CreateEventTracker API.

  • user_id (Optional[UserId], default: None ) –

    The user associated with the event.

  • session_id (StringType) –

    The session ID associated with the user's visit. Your application generates the sessionId when a user first visits your website or uses your application. Amazon Personalize uses the sessionId to associate events with the user before they log in. For more information, see Recording item interaction events.

  • event_list (EventList) –

    A list of event data from the session.

Raises:

Source code in docs_src/capo_personalize_events/_services/async_personalize_events.py
async def put_events(
    self,
    tracking_id: "capo_personalize_events.types.string_type.StringType",
    session_id: "capo_personalize_events.types.string_type.StringType",
    event_list: "capo_personalize_events.types.event_list.EventList",
    *,
    config_overrides: Optional[AsyncPersonalizeEventsClientConfig] = None,
    user_id: Optional["capo_personalize_events.types.user_id.UserId"] = None,
) -> None:
    """<p>Records item interaction event data. For more information see <a href="https://docs.aws.amazon.com/personalize/latest/dg/recording-item-interaction-events.html">Recording item interaction events</a>.</p>

    Args:
        tracking_id: <p>The tracking ID for the event. The ID is generated by a call to the <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_CreateEventTracker.html">CreateEventTracker</a> API.</p>
        user_id: <p>The user associated with the event.</p>
        session_id: <p>The session ID associated with the user's visit. Your application generates the sessionId when a user first visits your website or uses your application. Amazon Personalize uses the sessionId to associate events with the user before they log in. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/recording-item-interaction-events.html">Recording item interaction events</a>.</p>
        event_list: <p>A list of event data from the session.</p>

    Raises:
        capo_personalize_events.errors.invalid_input_exception.InvalidInputException: <p>Provide a valid value for the field or parameter.</p>
        capo_personalize_events.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_personalize_events.types.put_events_request.PutEventsRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_personalize_events._operations.amazon_personalize_events.put_events

        (
            output,
            http_response,
        ) = await capo_personalize_events._operations.amazon_personalize_events.put_events.async_put_events(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_personalize_events.types.put_events_request.PutEventsRequest",
    ) -> dict[str, Any]:
        import capo_personalize_events.types.put_events_request

        return capo_personalize_events.types.put_events_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutEvents", redact_input=_redact_input)
    )
    input_: capo_personalize_events.types.put_events_request.PutEventsRequest = {
        "tracking_id": tracking_id,
        "session_id": session_id,
        "event_list": event_list,
    }
    if user_id is not None:
        input_["user_id"] = user_id

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