PersonalizeEvents

Client

class PersonalizeEvents.Client

A low-level client representing Amazon Personalize Events:

client = session.create_client('personalize-events')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
put_events(**kwargs)

Records user interaction event data. For more information see event-record-api .

See also: AWS API Documentation

Request Syntax

response = client.put_events(
    trackingId='string',
    userId='string',
    sessionId='string',
    eventList=[
        {
            'eventId': 'string',
            'eventType': 'string',
            'eventValue': ...,
            'itemId': 'string',
            'properties': 'string',
            'sentAt': datetime(2015, 1, 1),
            'recommendationId': 'string',
            'impression': [
                'string',
            ]
        },
    ]
)
Parameters
  • trackingId (string) --

    [REQUIRED]

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

  • userId (string) -- The user associated with the event.
  • sessionId (string) --

    [REQUIRED]

    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 event-record-api .

  • eventList (list) --

    [REQUIRED]

    A list of event data from the session.

    • (dict) --

      Represents user interaction event information sent using the PutEvents API.

      • eventId (string) --

        An ID associated with the event. If an event ID is not provided, Amazon Personalize generates a unique ID for the event. An event ID is not used as an input to the model. Amazon Personalize uses the event ID to distinquish unique events. Any subsequent events after the first with the same event ID are not used in model training.

      • eventType (string) -- [REQUIRED]

        The type of event. This property corresponds to the EVENT_TYPE field of the Interactions schema.

      • eventValue (float) --

        The event value that corresponds to the EVENT_VALUE field of the Interactions schema.

      • itemId (string) --

        The item ID key that corresponds to the ITEM_ID field of the Interactions schema.

      • properties (string) --

        A string map of event-specific data that you might choose to record. For example, if a user rates a movie on your site, other than movie ID (itemId ) and rating (eventValue ) , you might also send the number of movie ratings made by the user.

        Each item in the map consists of a key-value pair. For example,

        {"numberOfRatings": "12"}

        The keys use camel case names that match the fields in the Interactions schema. In the above example, the numberOfRatings would match the 'NUMBER_OF_RATINGS' field defined in the Interactions schema.

      • sentAt (datetime) -- [REQUIRED]

        The timestamp (in Unix time) on the client side when the event occurred.

      • recommendationId (string) --

        The ID of the recommendation.

      • impression (list) --

        A list of item IDs that represents the sequence of items you have shown the user. For example, ["itemId1", "itemId2", "itemId3"] .

        • (string) --
Returns

None

Exceptions

Client Exceptions

Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.

The available client exceptions are:

class PersonalizeEvents.Client.exceptions.InvalidInputException

Provide a valid value for the field or parameter.

Example

try:
  ...
except client.exceptions.InvalidInputException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    Provide a valid value for the field or parameter.

    • message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.

Paginators

The available paginators are: