Skip to content

Examples

Index > SWF > 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.

Client 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)
  1. client: SWFClient
  2. result: WorkflowExecutionCountTypeDef
Paginator 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)
  1. client: SWFClient
  2. paginator: GetWorkflowExecutionHistoryPaginator
  3. 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.

Client usage example
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)
  1. client: SWFClient
  2. kwargs: CountClosedWorkflowExecutionsInputRequestTypeDef
  3. result: WorkflowExecutionCountTypeDef
Paginator usage example
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)
  1. client: SWFClient
  2. paginator: GetWorkflowExecutionHistoryPaginator
  3. item: HistoryTypeDef