get_bots

get_bots(**kwargs)

Returns bot information as follows:

  • If you provide the nameContains field, the response includes information for the $LATEST version of all bots whose name contains the specified string.
  • If you don't specify the nameContains field, the operation returns information about the $LATEST version of all of your bots.

This operation requires permission for the lex:GetBots action.

See also: AWS API Documentation

Request Syntax

response = client.get_bots(
    nextToken='string',
    maxResults=123,
    nameContains='string'
)
Parameters
  • nextToken (string) -- A pagination token that fetches the next page of bots. If the response to this call is truncated, Amazon Lex returns a pagination token in the response. To fetch the next page of bots, specify the pagination token in the next request.
  • maxResults (integer) -- The maximum number of bots to return in the response that the request will return. The default is 10.
  • nameContains (string) -- Substring to match in bot names. A bot will be returned if any part of its name matches the substring. For example, "xyz" matches both "xyzabc" and "abcxyz."
Return type

dict

Returns

Response Syntax

{
    'bots': [
        {
            'name': 'string',
            'description': 'string',
            'status': 'BUILDING'|'READY'|'READY_BASIC_TESTING'|'FAILED'|'NOT_BUILT',
            'lastUpdatedDate': datetime(2015, 1, 1),
            'createdDate': datetime(2015, 1, 1),
            'version': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • bots (list) --

      An array of botMetadata objects, with one entry for each bot.

      • (dict) --

        Provides information about a bot. .

        • name (string) --

          The name of the bot.

        • description (string) --

          A description of the bot.

        • status (string) --

          The status of the bot.

        • lastUpdatedDate (datetime) --

          The date that the bot was updated. When you create a bot, the creation date and last updated date are the same.

        • createdDate (datetime) --

          The date that the bot was created.

        • version (string) --

          The version of the bot. For a new bot, the version is always $LATEST .

    • nextToken (string) --

      If the response is truncated, it includes a pagination token that you can specify in your next request to fetch the next page of bots.

Exceptions

  • LexModelBuildingService.Client.exceptions.NotFoundException
  • LexModelBuildingService.Client.exceptions.LimitExceededException
  • LexModelBuildingService.Client.exceptions.InternalFailureException
  • LexModelBuildingService.Client.exceptions.BadRequestException

Examples

This example shows how to get a list of all of the bots in your account.

response = client.get_bots(
    maxResults=5,
    nextToken='',
)

print(response)

Expected Output:

{
    'bots': [
        {
            'version': '$LATEST',
            'name': 'DocOrderPizzaBot',
            'createdDate': 1494360160.133,
            'description': 'Orders a pizza from a local pizzeria.',
            'lastUpdatedDate': 1494360160.133,
            'status': 'NOT_BUILT',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}