types-boto3-sts

raw JSON →
1.42.91 verified Mon Apr 27 auth: no python

Type annotations for boto3 STS service, generated by mypy-boto3-builder. Provides type hints for AWS Security Token Service (STS) to enable static type checking with mypy or pyright. Current version 1.42.91, requires Python >=3.9. Released as part of the mypy-boto3-builder ecosystem; follows boto3 releases closely.

pip install types-boto3-sts
error ModuleNotFoundError: No module named 'mypy_boto3_sts'
cause The package is installed as 'types-boto3-sts' but the import uses 'mypy_boto3_sts'.
fix
Run 'pip install types-boto3-sts' and import as 'from mypy_boto3_sts import ...'.
error Cannot find reference 'STSClient' in '__init__.py'
cause IDE or type checker not recognizing the stub package.
fix
Ensure types-boto3-sts is installed and your type checker (mypy, pyright) is configured to use stubs.
breaking Generated type definitions for method arguments and TypeDefs changed in builder v8.9.0: shorter names (e.g., CreateDistributionRequestTypeDef instead of CreateDistributionRequestRequestTypeDef). Existing code using old TypeDef names will break.
fix Update imports to use the new TypeDef names (remove duplicate 'Request' suffix).
breaking Removed support for Python 3.8 as of mypy-boto3-builder v8.12.0.
fix Upgrade to Python >=3.9.
gotcha This package provides type hints only; you must also install boto3 at runtime. The package itself does not include any runtime code.
fix Ensure boto3 is in your dependencies: pip install boto3.

Create an STS client with type hints and call get_caller_identity.

import boto3
from mypy_boto3_sts import STSClient

client: STSClient = boto3.client('sts', 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', ''))
response = client.get_caller_identity()
print(f"Account: {response['Account']}")