mypy-boto3-macie2 Type Annotations for AWS Macie2

1.42.3 · active · verified Sat Apr 11

mypy-boto3-macie2 provides type annotations for the AWS Macie2 service client in boto3. It helps improve code quality and catch type-related errors during development by offering static type checking for Macie2 service calls. The current version is 1.42.3, and it follows a release cadence tied to the upstream boto3 library and its own builder updates.

Warnings

Install

Imports

Quickstart

Demonstrates how to initialize a type-hinted Macie2 client and use a type-checked request parameter, allowing MyPy to validate method calls and data structures.

import boto3
from mypy_boto3_macie2 import Macie2Client
from mypy_boto3_macie2.type_defs import ListFindingsRequestRequestTypeDef

def analyze_macie_findings() -> None:
    # mypy will now correctly type-check the client
    client: Macie2Client = boto3.client("macie2")

    # Example of a type-checked request parameter
    request_params: ListFindingsRequestRequestTypeDef = {
        "maxResults": 10
    }
    
    try:
        response = client.list_findings(**request_params)
        print(f"Found {len(response.get('findingIds', []))} Macie findings.")
    except Exception as e:
        print(f"Error listing Macie findings: {e}")

if __name__ == "__main__":
    analyze_macie_findings()

view raw JSON →