mypy-boto3-workmailmessageflow Type Annotations

1.42.3 · active · verified Sat Apr 11

mypy-boto3-workmailmessageflow provides type annotations (stubs) for the boto3 WorkMailMessageFlow service. These stubs enhance static analysis, autocomplete, and type checking in IDEs and tools like MyPy. The package is currently at version 1.42.3, generated by mypy-boto3-builder 8.12.0, and typically releases updates in alignment with new boto3 and botocore versions.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize a WorkMailMessageFlow client with type annotations and call a method to retrieve raw message content. It uses environment variables for AWS credentials and region, falling back to placeholders for demonstration purposes. Note that `mypy-boto3-workmailmessageflow` only provides type information, so `boto3` must be installed separately.

import boto3
from mypy_boto3_workmailmessageflow import WorkMailMessageFlowClient
from os import environ

# Instantiate a WorkMailMessageFlow client with type hints
client: WorkMailMessageFlowClient = boto3.client(
    "workmailmessageflow",
    region_name=environ.get("AWS_REGION", "us-east-1"),
    aws_access_key_id=environ.get("AWS_ACCESS_KEY_ID", ""),
    aws_secret_access_key=environ.get("AWS_SECRET_ACCESS_KEY", "")
)

# Example usage: Get raw message content (requires an existing message ID)
# Replace 'your-message-id' with an actual message ID from WorkMailMessageFlow
try:
    message_id = environ.get("WORKMAIL_MESSAGE_ID", "your-message-id")
    response = client.get_raw_message_content(
        messageId=message_id
    )
    print(f"Successfully retrieved message content for ID: {message_id}")
    # The Body is a StreamingBody, read its content
    # with response['messageContent']._raw_stream as stream:
    #    print(stream.read().decode('utf-8'))
except client.exceptions.MessageNotFoundException:
    print(f"Message with ID '{message_id}' not found.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →