Examples#
Index > CloudSearch > Examples
Auto-generated documentation for CloudSearch type annotations stubs module mypy-boto3-cloudsearch.
Client#
Implicit type annotations#
Can be used with boto3-stubs[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)
- client: CloudSearchClient
- result: BuildSuggestersResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[cloudsearch]
or a standalone mypy_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 mypy_boto3_cloudsearch.client import CloudSearchClient
from mypy_boto3_cloudsearch.type_defs import BuildSuggestersResponseTypeDef
from mypy_boto3_cloudsearch.type_defs import BuildSuggestersRequestRequestTypeDef
session = Session()
client: CloudSearchClient = session.client("cloudsearch")
kwargs: BuildSuggestersRequestRequestTypeDef = {...}
result: BuildSuggestersResponseTypeDef = client.build_suggesters(**kwargs)