mypy-boto3-pinpoint-sms-voice-v2 Type Annotations

1.42.80 · active · verified Sat Apr 11

mypy-boto3-pinpoint-sms-voice-v2 provides type annotations for the boto3 Pinpoint SMS Voice V2 service, generated by mypy-boto3-builder. These stubs enhance type checking for AWS SDK usage, preventing common runtime errors. The current version is 1.42.80, with releases synchronized with boto3 versions.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a boto3 client for Pinpoint SMS Voice V2 and leverage the type annotations provided by mypy-boto3-pinpoint-sms-voice-v2. It's crucial to have both `boto3` and the stub package installed. The example includes basic client usage with type hints.

import boto3
from mypy_boto3_pinpoint_sms_voice_v2.client import PinpointSMSVoiceV2Client
import os

# Instantiate a boto3 session and client
# mypy will use the installed stubs to provide type hints for 'client'
region = os.environ.get('AWS_REGION', 'us-east-1')
session = boto3.Session(region_name=region)
client: PinpointSMSVoiceV2Client = session.client("pinpoint-sms-voice-v2")

# Example of using the typed client (replace with actual values and error handling)
try:
    response = client.send_voice_message(
        DestinationPhoneNumber="+15551234567", # Replace with a valid E.164 number
        OriginationIdentity="MyVoiceSenderId", # Your registered origination identity
        MessageBody="Hello from mypy-boto3-pinpoint-sms-voice-v2!",
        ConfigurationSetName="Default", # Your existing configuration set
        CallerId="+15559876543" # Optional, if you have a caller ID
    )
    print(f"Voice message sent. Message ID: {response['MessageId']}")
except client.exceptions.ResourceNotFoundException as e:
    print(f"Error: Resource not found: {e}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →