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