Examples#
Index > OpenSearchService > Examples
Auto-generated documentation for OpenSearchService type annotations stubs module types-boto3-opensearch.
Client#
Implicit type annotations#
Can be used with types-boto3[opensearch]
package installed.
Write your OpenSearchService
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# OpenSearchServiceClient usage example
from boto3.session import Session
session = Session()
client = session.client("opensearch") # (1)
result = client.accept_inbound_connection() # (2)
- client: OpenSearchServiceClient
- result: AcceptInboundConnectionResponseTypeDef
Paginator usage example#
# ListApplicationsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("opensearch") # (1)
paginator = client.get_paginator("list_applications") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: OpenSearchServiceClient
- paginator: ListApplicationsPaginator
- item: ListApplicationsResponseTypeDef
Explicit type annotations#
With types-boto3-lite[opensearch]
or a standalone types_boto3_opensearch
package, you have to explicitly specify client: OpenSearchServiceClient
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.
Client method usage example#
# OpenSearchServiceClient usage example with type annotations
from boto3.session import Session
from types_boto3_opensearch.client import OpenSearchServiceClient
from types_boto3_opensearch.type_defs import AcceptInboundConnectionResponseTypeDef
from types_boto3_opensearch.type_defs import AcceptInboundConnectionRequestTypeDef
session = Session()
client: OpenSearchServiceClient = session.client("opensearch")
kwargs: AcceptInboundConnectionRequestTypeDef = {...}
result: AcceptInboundConnectionResponseTypeDef = client.accept_inbound_connection(**kwargs)
Paginator usage example#
# ListApplicationsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_opensearch.client import OpenSearchServiceClient
from types_boto3_opensearch.paginator import ListApplicationsPaginator
from types_boto3_opensearch.type_defs import ListApplicationsResponseTypeDef
session = Session()
client: OpenSearchServiceClient = session.client("opensearch")
paginator: ListApplicationsPaginator = client.get_paginator("list_applications")
for item in paginator.paginate(...):
item: ListApplicationsResponseTypeDef
print(item)