Examples#
Auto-generated documentation for SFN type annotations stubs module types-aiobotocore-stepfunctions.
Client#
Implicit type annotations#
Can be used with types-aiobotocore[stepfunctions]
package installed.
Write your SFN
code as usual,
type checking and code completion should work out of the box.
# SFNClient usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("stepfunctions") as client: # (1)
result = await client.create_activity() # (2)
- client: SFNClient
- result: CreateActivityOutputTypeDef
# GetExecutionHistoryPaginator usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("stepfunctions") as client: # (1)
paginator = client.get_paginator("get_execution_history") # (2)
async for item in paginator.paginate(...):
print(item) # (3)
- client: SFNClient
- paginator: GetExecutionHistoryPaginator
- item: GetExecutionHistoryOutputTypeDef
Explicit type annotations#
With types-aiobotocore-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 aiobotocore.session import get_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 = get_session()
async with session.create_client("stepfunctions") as client:
client: SFNClient
kwargs: CreateActivityInputRequestTypeDef = {...}
result: CreateActivityOutputTypeDef = await client.create_activity(**kwargs)
# GetExecutionHistoryPaginator usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_stepfunctions.client import SFNClient
from types_aiobotocore_stepfunctions.paginator import GetExecutionHistoryPaginator
from types_aiobotocore_stepfunctions.type_defs import GetExecutionHistoryOutputTypeDef
session = get_session()
async with session.create_client("stepfunctions") as client:
client: SFNClient
paginator: GetExecutionHistoryPaginator = client.get_paginator("get_execution_history")
async for item in paginator.paginate(...):
item: GetExecutionHistoryOutputTypeDef
print(item)