types-aiobotocore-wafv2
raw JSON → 3.5.0 verified Fri May 01 auth: no python
Type annotations for aiobotocore WAFV2 service (version 3.5.0), generated by mypy-boto3-builder 8.12.0. Provides static typing stubs for AWS WAFV2 async client and service resources when using aiobotocore. Compatible with Python >=3.9.
pip install 'types-aiobotocore-wafv2' Common errors
error ModuleNotFoundError: No module named 'types_aiobotocore_wafv2' ↓
cause The stubs package is not installed. It must be installed separately from aiobotocore.
fix
pip install types-aiobotocore-wafv2
error ImportError: cannot import name 'WAFV2Client' from 'types_aiobotocore_wafv2' ↓
cause The client class may have a different name or be located in a submodule. Usually it's at the top level.
fix
Check if the correct import is 'from types_aiobotocore_wafv2 import WAFV2Client'. If still failing, check the package version compatibility with aiobotocore.
error TypeError: Type aliases cannot be used with isinstance() ↓
cause The stubs use TypeAlias annotations (e.g., from typing) which are not intended for runtime isinstance checks.
fix
Avoid isinstance checks against type aliases from stubs; use duck-typing or reference the actual boto3 types.
error AttributeError: 'AioBaseClient' object has no attribute 'list_web_acls' ↓
cause The async client is not properly typed; likely a missing stubs package or version mismatch.
fix
Ensure types-aiobotocore-wafv2 is installed and matches the aiobotocore version. Check that you are using the async client correctly (async with session.create_client).
Warnings
breaking Version 8.9.0 of the builder introduced breaking changes: TypeDefs for packed method arguments use shorter names (e.g., CreateDistributionRequestRequestTypeDef -> CreateDistributionRequestTypeDef). This affects type definitions inherited from the builder. ↓
fix Update any hardcoded type names to match the new shorter pattern. Check your type hints for any RequestRequestTypeDef suffixes.
deprecated Python 3.8 support was removed in version 8.12.0. This package requires Python >=3.9. ↓
fix Upgrade your Python runtime to 3.9 or later.
gotcha The package only provides type stubs. It does not include the actual aiobotocore client implementation. You must have aiobotocore and boto3 installed separately. ↓
fix Install aiobotocore (e.g., pip install aiobotocore) alongside this stubs package.
gotcha The top-level package name is types_aiobotocore_wafv2 (with underscores), not types-aiobotocore-wafv2 (with hyphens). Python import paths use underscores. ↓
fix Use import from types_aiobotocore_wafv2, not from types_aiobotocore_wafv2 (can't import with hyphens).
Imports
- WAFV2Client wrong
from types_aiobotocore_wafv2.client import WAFV2Clientcorrectfrom types_aiobotocore_wafv2 import WAFV2Client - WAFV2ServiceResource wrong
from aiobotocore.client import WAFV2ServiceResourcecorrectfrom types_aiobotocore_wafv2 import WAFV2ServiceResource
Quickstart
import os
from types_aiobotocore_wafv2 import WAFV2Client
async def get_web_acls():
# Replace with actual credentials
session = aiobotocore.session.AioSession()
async with session.create_client('wafv2', 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:
# client is now type-annotated as WAFV2Client
result = await client.list_web_acls(Scope='REGIONAL')
return result['WebACLs']