types-aiobotocore-opensearch
raw JSON → 3.5.0 verified Fri May 01 auth: no python
Type annotations for aiobotocore's OpenSearch service client, providing static type checking support for boto3/aiobotocore OpenSearch operations. Automatically generated from service model using mypy-boto3-builder. Current version 3.5.0, compatible with Python >=3.9. Releases follow aiobotocore versioning, typically updated together with new AWS SDK releases.
pip install types-aiobotocore-opensearch Common errors
error ModuleNotFoundError: No module named 'types_aiobotocore_opensearch' ↓
cause Package not installed or installed under a different name.
fix
Run 'pip install types-aiobotocore-opensearch' (hyphenated, not underscored).
error ImportError: cannot import name 'OpenSearchServiceClient' from 'types_aiobotocore_opensearch' ↓
cause Trying to import runtime classes from the types stub package, which only provides type hints.
fix
Import the client from 'aiobotocore' or 'boto3' instead: 'from aiobotocore.client import AioBaseClient' or use 'session.create_client('opensearch')'.
error AttributeError: module 'types_aiobotocore_opensearch' has no attribute 'OpenSearchServiceClient' ↓
cause Same as above – the types package does not export any runtime attributes.
fix
Use the actual aiobotocore client: 'from aiobotocore.session import get_session'.
Warnings
breaking Types package provides NO runtime functionality. Attempting to import classes from types_aiobotocore_opensearch will fail at runtime. ↓
fix Import client from aiobotocore or boto3, not from the types package.
gotcha Type annotations are generated from service model; they may not cover all customizations or edge cases. Missing or incorrect type hints are possible. ↓
fix Use type: ignore comments or add explicit casts when needed. Report issues to the mypy_boto3_builder repository.
deprecated Python 3.8 support was dropped in mypy-boto3-builder v8.12.0. This types package requires Python >=3.9. ↓
fix Upgrade Python to 3.9 or later.
Imports
- OpenSearchServiceClient wrong
from types_aiobotocore_opensearch import OpenSearchServiceClientcorrectfrom aiobotocore.client import AioBaseClient
Quickstart
import asyncio
from aiobotocore.session import get_session
async def main():
session = get_session()
async with session.create_client('opensearch', region_name='us-east-1',
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', '')) as client:
# List domain names (example)
result = await client.list_domain_names()
print(result)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())