Examples#
Auto-generated documentation for SWF type annotations stubs module types-aiobotocore-swf.
Client#
Implicit type annotations#
Can be used with types-aioboto3[swf]
package installed.
Write your SWF
code as usual,
type checking and code completion should work out of the box.
# SWFClient usage example
from aioboto3.session import Session
session = Session()
async with session.client("swf") as client: # (1)
result = await client.count_closed_workflow_executions() # (2)
- client: SWFClient
- result: WorkflowExecutionCountTypeDef
# GetWorkflowExecutionHistoryPaginator usage example
from aioboto3.session import Session
session = Session()
async with session.client("swf") as client: # (1)
paginator = client.get_paginator("get_workflow_execution_history") # (2)
async for item in paginator.paginate(...):
print(item) # (3)
- client: SWFClient
- paginator: GetWorkflowExecutionHistoryPaginator
- item: HistoryTypeDef
Explicit type annotations#
With types-aioboto3-lite[swf]
or a standalone types_aiobotocore_swf
package, you have to explicitly specify
client: SWFClient
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.
# SWFClient usage example with type annotations
from aioboto3.session import Session
from types_aiobotocore_swf.client import SWFClient
from types_aiobotocore_swf.type_defs import WorkflowExecutionCountTypeDef
from types_aiobotocore_swf.type_defs import CountClosedWorkflowExecutionsInputRequestTypeDef
session = Session()
client: SWFClient
async with session.client("swf") as client: # (1)
kwargs: CountClosedWorkflowExecutionsInputRequestTypeDef = {...} # (2)
result: WorkflowExecutionCountTypeDef = await client.count_closed_workflow_executions(**kwargs) # (3)
- client: SWFClient
- kwargs: CountClosedWorkflowExecutionsInputRequestTypeDef
- result: WorkflowExecutionCountTypeDef
# GetWorkflowExecutionHistoryPaginator usage example with type annotations
from aioboto3.session import Session
from types_aiobotocore_swf.client import SWFClient
from types_aiobotocore_swf.paginator import GetWorkflowExecutionHistoryPaginator
from types_aiobotocore_swf.type_defs import HistoryTypeDef
session = Session()
client: SWFClient
async with session.client("swf") as client: # (1)
paginator: GetWorkflowExecutionHistoryPaginator = client.get_paginator("get_workflow_execution_history") # (2)
async for item in paginator.paginate(...):
item: HistoryTypeDef
print(item) # (3)
- client: SWFClient
- paginator: GetWorkflowExecutionHistoryPaginator
- item: HistoryTypeDef