Skip to content

Examples#

Index > SWF > Examples

Auto-generated documentation for SWF type annotations stubs module types-boto3-swf.

Client#

Implicit type annotations#

Can be used with types-boto3[swf] package installed.

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

Client method usage example#

# SWFClient usage example

from boto3.session import Session


session = Session()

client = session.client("swf")  # (1)
result = client.count_closed_workflow_executions()  # (2)
  1. client: SWFClient
  2. result: WorkflowExecutionCountTypeDef

Paginator usage example#

# GetWorkflowExecutionHistoryPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("get_workflow_execution_history")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: SWFClient
  2. paginator: GetWorkflowExecutionHistoryPaginator
  3. item: HistoryTypeDef

Explicit type annotations#

With types-boto3-lite[swf] or a standalone types_boto3_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.

Client method usage example#

# SWFClient usage example with type annotations

from boto3.session import Session

from types_boto3_swf.client import SWFClient
from types_boto3_swf.type_defs import WorkflowExecutionCountTypeDef
from types_boto3_swf.type_defs import CountClosedWorkflowExecutionsInputTypeDef


session = Session()

client: SWFClient = session.client("swf")

kwargs: CountClosedWorkflowExecutionsInputTypeDef = {...}
result: WorkflowExecutionCountTypeDef = client.count_closed_workflow_executions(**kwargs)

Paginator usage example#

# GetWorkflowExecutionHistoryPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_swf.client import SWFClient
from types_boto3_swf.paginator import GetWorkflowExecutionHistoryPaginator
from types_boto3_swf.type_defs import HistoryTypeDef


session = Session()
client: SWFClient = session.client("swf")

paginator: GetWorkflowExecutionHistoryPaginator = client.get_paginator("get_workflow_execution_history")
for item in paginator.paginate(...):
    item: HistoryTypeDef
    print(item)