Skip to content

Examples#

Index > CloudSearch > Examples

Auto-generated documentation for CloudSearch type annotations stubs module types-boto3-cloudsearch.

Client#

Implicit type annotations#

Can be used with types-boto3[cloudsearch] package installed.

Write your CloudSearch code as usual, type checking and code completion should work out of the box.

# CloudSearchClient usage example

from boto3.session import Session


session = Session()

client = session.client("cloudsearch")  # (1)
result = client.build_suggesters()  # (2)
  1. client: CloudSearchClient
  2. result: BuildSuggestersResponseTypeDef

Explicit type annotations#

With types-boto3-lite[cloudsearch] or a standalone types_boto3_cloudsearch package, you have to explicitly specify client: CloudSearchClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# CloudSearchClient usage example with type annotations

from boto3.session import Session

from types_boto3_cloudsearch.client import CloudSearchClient
from types_boto3_cloudsearch.type_defs import BuildSuggestersResponseTypeDef
from types_boto3_cloudsearch.type_defs import BuildSuggestersRequestRequestTypeDef


session = Session()

client: CloudSearchClient = session.client("cloudsearch")

kwargs: BuildSuggestersRequestRequestTypeDef = {...}
result: BuildSuggestersResponseTypeDef = client.build_suggesters(**kwargs)