mypy-boto3-socialmessaging Type Annotations

1.42.28 · active · verified Sat Apr 11

Type annotations for the `boto3` AWS SDK's EndUserMessagingSocial service. This library provides static type checking and autocompletion for `boto3` clients and resources related to the Social Messaging service, generated by `mypy-boto3-builder`. It is compatible with various IDEs and static analysis tools like mypy and pyright. The current version is 1.42.28, and it follows a frequent release cadence, often aligning with `boto3` and `botocore` updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain and use a type-hinted `boto3` client for the EndUserMessagingSocial service. It shows the correct import for the client and a basic pattern for instantiation. While the example `get_profile_snapshot` is commented out as it requires specific AWS resources, the setup for type-hinting is complete.

import boto3
from mypy_boto3_socialmessaging.client import EndUserMessagingSocialClient
from os import environ
from typing import TYPE_CHECKING

# This example assumes AWS credentials are configured (e.g., via environment variables, ~/.aws/credentials, or IAM roles).

if TYPE_CHECKING:
    # Only for type checking, not needed at runtime if boto3 is installed
    from mypy_boto3_socialmessaging.type_defs import GetProfileSnapshotResponseTypeDef

def get_social_messaging_client() -> EndUserMessagingSocialClient:
    """Returns a type-hinted boto3 SocialMessaging client."""
    region = environ.get("AWS_REGION", "us-east-1") # Default region if not set
    return boto3.client("end-user-messaging-social", region_name=region)

# Example usage:
# client: EndUserMessagingSocialClient = get_social_messaging_client()
# try:
#     # Replace with actual API calls for EndUserMessagingSocial
#     response: GetProfileSnapshotResponseTypeDef = client.get_profile_snapshot()
#     print(f"Successfully retrieved profile snapshot: {response}")
# except client.exceptions.ResourceNotFoundException:
#     print("Profile snapshot not found.")
# except Exception as e:
#     print(f"An error occurred: {e}")

print("mypy-boto3-socialmessaging stubs are installed and ready for type-hinting!")
print("Example client function defined: get_social_messaging_client()")

view raw JSON →