Examples#
Auto-generated documentation for Budgets type annotations stubs module mypy-boto3-budgets.
Client#
Implicit type annotations#
Can be used with boto3-stubs[budgets]
package installed.
Write your Budgets
code as usual,
type checking and code completion should work out of the box.
# BudgetsClient usage example
from boto3.session import Session
session = Session()
client = session.client("budgets") # (1)
result = client.create_budget_action() # (2)
- client: BudgetsClient
- result: CreateBudgetActionResponseTypeDef
# DescribeBudgetActionHistoriesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("budgets") # (1)
paginator = client.get_paginator("describe_budget_action_histories") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: BudgetsClient
- paginator: DescribeBudgetActionHistoriesPaginator
- item: DescribeBudgetActionHistoriesResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[budgets]
or a standalone mypy_boto3_budgets
package, you have to explicitly specify client: BudgetsClient
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.
# BudgetsClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_budgets.client import BudgetsClient
from mypy_boto3_budgets.type_defs import CreateBudgetActionResponseTypeDef
from mypy_boto3_budgets.type_defs import CreateBudgetActionRequestRequestTypeDef
session = Session()
client: BudgetsClient = session.client("budgets")
kwargs: CreateBudgetActionRequestRequestTypeDef = {...}
result: CreateBudgetActionResponseTypeDef = client.create_budget_action(**kwargs)
# DescribeBudgetActionHistoriesPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_budgets.client import BudgetsClient
from mypy_boto3_budgets.paginator import DescribeBudgetActionHistoriesPaginator
from mypy_boto3_budgets.type_defs import DescribeBudgetActionHistoriesResponseTypeDef
session = Session()
client: BudgetsClient = session.client("budgets")
paginator: DescribeBudgetActionHistoriesPaginator = client.get_paginator("describe_budget_action_histories")
for item in paginator.paginate(...):
item: DescribeBudgetActionHistoriesResponseTypeDef
print(item)