Skip to content

Examples#

Index > CostExplorer > Examples

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

Client#

Implicit type annotations#

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

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

# CostExplorerClient usage example

from boto3.session import Session


session = Session()

client = session.client("ce")  # (1)
result = client.create_anomaly_monitor()  # (2)
  1. client: CostExplorerClient
  2. result: CreateAnomalyMonitorResponseTypeDef

Explicit type annotations#

With types-boto3-lite[ce] or a standalone types_boto3_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 boto3.session import Session

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


session = Session()

client: CostExplorerClient = session.client("ce")

kwargs: CreateAnomalyMonitorRequestRequestTypeDef = {...}
result: CreateAnomalyMonitorResponseTypeDef = client.create_anomaly_monitor(**kwargs)