Skip to content

Examples#

Index > SMS > Examples

Auto-generated documentation for SMS type annotations stubs module mypy-boto3-sms.

Client#

Implicit type annotations#

Can be used with boto3-stubs[sms] package installed.

Write your SMS code as usual, type checking and code completion should work out of the box.

Client method usage example#

# SMSClient usage example

from boto3.session import Session


session = Session()

client = session.client("sms")  # (1)
result = client.create_app()  # (2)
  1. client: SMSClient
  2. result: CreateAppResponseTypeDef

Paginator usage example#

# GetConnectorsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("sms")  # (1)

paginator = client.get_paginator("get_connectors")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: SMSClient
  2. paginator: GetConnectorsPaginator
  3. item: GetConnectorsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[sms] or a standalone mypy_boto3_sms package, you have to explicitly specify client: SMSClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

Client method usage example#

# SMSClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_sms.client import SMSClient
from mypy_boto3_sms.type_defs import CreateAppResponseTypeDef
from mypy_boto3_sms.type_defs import CreateAppRequestTypeDef


session = Session()

client: SMSClient = session.client("sms")

kwargs: CreateAppRequestTypeDef = {...}
result: CreateAppResponseTypeDef = client.create_app(**kwargs)

Paginator usage example#

# GetConnectorsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_sms.client import SMSClient
from mypy_boto3_sms.paginator import GetConnectorsPaginator
from mypy_boto3_sms.type_defs import GetConnectorsResponseTypeDef


session = Session()
client: SMSClient = session.client("sms")

paginator: GetConnectorsPaginator = client.get_paginator("get_connectors")
for item in paginator.paginate(...):
    item: GetConnectorsResponseTypeDef
    print(item)