Skip to content

Examples#

Index > Outposts > Examples

Auto-generated documentation for Outposts type annotations stubs module mypy-boto3-outposts.

Client#

Implicit type annotations#

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

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

Client method usage example#

# OutpostsClient usage example

from boto3.session import Session


session = Session()

client = session.client("outposts")  # (1)
result = client.create_order()  # (2)
  1. client: OutpostsClient
  2. result: CreateOrderOutputTypeDef

Paginator usage example#

# GetOutpostInstanceTypesPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("get_outpost_instance_types")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: OutpostsClient
  2. paginator: GetOutpostInstanceTypesPaginator
  3. item: GetOutpostInstanceTypesOutputTypeDef

Explicit type annotations#

With boto3-stubs-lite[outposts] or a standalone mypy_boto3_outposts package, you have to explicitly specify client: OutpostsClient 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#

# OutpostsClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_outposts.client import OutpostsClient
from mypy_boto3_outposts.type_defs import CreateOrderOutputTypeDef
from mypy_boto3_outposts.type_defs import CreateOrderInputTypeDef


session = Session()

client: OutpostsClient = session.client("outposts")

kwargs: CreateOrderInputTypeDef = {...}
result: CreateOrderOutputTypeDef = client.create_order(**kwargs)

Paginator usage example#

# GetOutpostInstanceTypesPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_outposts.client import OutpostsClient
from mypy_boto3_outposts.paginator import GetOutpostInstanceTypesPaginator
from mypy_boto3_outposts.type_defs import GetOutpostInstanceTypesOutputTypeDef


session = Session()
client: OutpostsClient = session.client("outposts")

paginator: GetOutpostInstanceTypesPaginator = client.get_paginator("get_outpost_instance_types")
for item in paginator.paginate(...):
    item: GetOutpostInstanceTypesOutputTypeDef
    print(item)