Skip to content

Examples#

Index > CostExplorer > Examples

Auto-generated documentation for CostExplorer type annotations stubs module types-aiobotocore-ce.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[ce] package installed.

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

# CostExplorerClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("ce") as client:  # (1)
    result = await client.create_anomaly_monitor()  # (2)
  1. client: CostExplorerClient
  2. result: CreateAnomalyMonitorResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[ce] or a standalone types_aiobotocore_ce package, you have to explicitly specify client: CostExplorerClient 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.

# CostExplorerClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_ce.client import CostExplorerClient
from types_aiobotocore_ce.type_defs import CreateAnomalyMonitorResponseTypeDef
from types_aiobotocore_ce.type_defs import CreateAnomalyMonitorRequestRequestTypeDef


session = get_session()

async with session.create_client("ce") as client:
    client: CostExplorerClient
    kwargs: CreateAnomalyMonitorRequestRequestTypeDef = {...}
    result: CreateAnomalyMonitorResponseTypeDef = await client.create_anomaly_monitor(**kwargs)