Examples#
Auto-generated documentation for MQ type annotations stubs module types-boto3-mq.
Client#
Implicit type annotations#
Can be used with types-boto3[mq] package installed.
Write your MQ code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# MQClient usage example
from boto3.session import Session
session = Session()
client = session.client("mq") # (1)
result = client.create_broker() # (2)
- client: MQClient
- result: CreateBrokerResponseTypeDef
Paginator usage example#
# DescribeSharedResourcesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("mq") # (1)
paginator = client.get_paginator("describe_shared_resources") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: MQClient
- paginator: DescribeSharedResourcesPaginator
- item: DescribeSharedResourcesResponseTypeDef
Explicit type annotations#
With types-boto3-lite[mq]
or a standalone types_boto3_mq package, you have to explicitly specify client: MQClient 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#
# MQClient usage example with type annotations
from boto3.session import Session
from types_boto3_mq.client import MQClient
from types_boto3_mq.type_defs import CreateBrokerResponseTypeDef
from types_boto3_mq.type_defs import CreateBrokerRequestTypeDef
session = Session()
client: MQClient = session.client("mq")
kwargs: CreateBrokerRequestTypeDef = {...}
result: CreateBrokerResponseTypeDef = client.create_broker(**kwargs)
Paginator usage example#
# DescribeSharedResourcesPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_mq.client import MQClient
from types_boto3_mq.paginator import DescribeSharedResourcesPaginator
from types_boto3_mq.type_defs import DescribeSharedResourcesResponseTypeDef
session = Session()
client: MQClient = session.client("mq")
paginator: DescribeSharedResourcesPaginator = client.get_paginator("describe_shared_resources")
for item in paginator.paginate(...):
item: DescribeSharedResourcesResponseTypeDef
print(item)