Skip to content


Index > OpenSearchService > Examples

Auto-generated documentation for OpenSearchService type annotations stubs module mypy-boto3-opensearch.


Implicit type annotations#

Can be used with boto3-stubs[opensearch] package installed.

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

# OpenSearchServiceClient usage example

from boto3.session import Session

session = Session()

client = session.client("opensearch")  # (1)
result = client.accept_inbound_connection()  # (2)
  1. client: OpenSearchServiceClient
  2. result: AcceptInboundConnectionResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[opensearch] or a standalone mypy_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.

# OpenSearchServiceClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_opensearch.client import OpenSearchServiceClient
from mypy_boto3_opensearch.type_defs import AcceptInboundConnectionResponseTypeDef
from mypy_boto3_opensearch.type_defs import AcceptInboundConnectionRequestRequestTypeDef

session = Session()

client: OpenSearchServiceClient = session.client("opensearch")

kwargs: AcceptInboundConnectionRequestRequestTypeDef = {...}
result: AcceptInboundConnectionResponseTypeDef = client.accept_inbound_connection(**kwargs)