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#

# GetOutpostBillingInformationPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("get_outpost_billing_information")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: OutpostsClient
  2. paginator: GetOutpostBillingInformationPaginator
  3. item: GetOutpostBillingInformationOutputTypeDef

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#

# GetOutpostBillingInformationPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_outposts.client import OutpostsClient
from mypy_boto3_outposts.paginator import GetOutpostBillingInformationPaginator
from mypy_boto3_outposts.type_defs import GetOutpostBillingInformationOutputTypeDef


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

paginator: GetOutpostBillingInformationPaginator = client.get_paginator("get_outpost_billing_information")
for item in paginator.paginate(...):
    item: GetOutpostBillingInformationOutputTypeDef
    print(item)