Skip to content

Examples#

Index > SFN > Examples

Auto-generated documentation for SFN type annotations stubs module types-aiobotocore-stepfunctions.

Client#

Implicit type annotations#

Can be used with types-aioboto3[stepfunctions] package installed.

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

# SFNClient usage example

from aioboto3.session import Session


session = Session()

async with session.client("stepfunctions") as client:  # (1)
    result = await client.create_activity()  # (2)
  1. client: SFNClient
  2. result: CreateActivityOutputTypeDef
# GetExecutionHistoryPaginator usage example

from aioboto3.session import Session


session = Session()

async with session.client("stepfunctions") as client:  # (1)
    paginator = client.get_paginator("get_execution_history")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: SFNClient
  2. paginator: GetExecutionHistoryPaginator
  3. item: GetExecutionHistoryOutputTypeDef

Explicit type annotations#

With types-aioboto3-lite[stepfunctions] or a standalone types_aiobotocore_stepfunctions package, you have to explicitly specify client: SFNClient 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.

# SFNClient usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_stepfunctions.client import SFNClient
from types_aiobotocore_stepfunctions.type_defs import CreateActivityOutputTypeDef
from types_aiobotocore_stepfunctions.type_defs import CreateActivityInputRequestTypeDef


session = Session()

client: SFNClient
async with session.client("stepfunctions") as client:  # (1)
    kwargs: CreateActivityInputRequestTypeDef = {...}  # (2)
    result: CreateActivityOutputTypeDef = await client.create_activity(**kwargs)  # (3)
  1. client: SFNClient
  2. kwargs: CreateActivityInputRequestTypeDef
  3. result: CreateActivityOutputTypeDef
# GetExecutionHistoryPaginator usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_stepfunctions.client import SFNClient
from types_aiobotocore_stepfunctions.paginator import GetExecutionHistoryPaginator
from types_aiobotocore_stepfunctions.type_defs import GetExecutionHistoryOutputTypeDef


session = Session()

client: SFNClient
async with session.client("stepfunctions") as client:  # (1)
    paginator: GetExecutionHistoryPaginator = client.get_paginator("get_execution_history")  # (2)
    async for item in paginator.paginate(...):
        item: GetExecutionHistoryOutputTypeDef
        print(item)  # (3)
  1. client: SFNClient
  2. paginator: GetExecutionHistoryPaginator
  3. item: GetExecutionHistoryOutputTypeDef