mypy-boto3-workmail Type Annotations

1.42.3 · active · verified Sat Apr 11

mypy-boto3-workmail provides type annotations for the `boto3` WorkMail service, enabling static type checking with tools like MyPy and Pyright for `boto3.client('workmail')` calls. It is automatically generated by `mypy-boto3-builder` and is frequently updated in sync with `boto3` and `botocore` releases to provide up-to-date type hints.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-hinted WorkMail client using `mypy-boto3-workmail` and perform a basic API call like listing organizations. The `TYPE_CHECKING` block ensures that `mypy-boto3-workmail` is only used for type checking and not as a runtime dependency. Remember to have `boto3` installed for runtime execution.

import boto3
from mypy_boto3_workmail.client import WorkMailClient
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    client: WorkMailClient
else:
    client = boto3.client("workmail")

# Example usage: List organizations
# client = boto3.client("workmail") # In actual runtime, use this line

try:
    response = client.list_organizations(MaxResults=5) # Type-checked call
    for org in response.get("OrganizationSummaries", []):
        print(f"Organization ID: {org['OrganizationId']}, State: {org['State']}")
except client.exceptions.OrganizationNotFoundException:
    print("No WorkMail organizations found.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →