Examples#
Auto-generated documentation for Billing type annotations stubs module types-boto3-billing.
Client#
Implicit type annotations#
Can be used with types-boto3[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.create_billing_view() # (2)
- client: BillingClient
- result: CreateBillingViewResponseTypeDef
# 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 types-boto3-lite[billing]
or a standalone types_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 types_boto3_billing.client import BillingClient
from types_boto3_billing.type_defs import CreateBillingViewResponseTypeDef
from types_boto3_billing.type_defs import CreateBillingViewRequestRequestTypeDef
session = Session()
client: BillingClient = session.client("billing")
kwargs: CreateBillingViewRequestRequestTypeDef = {...}
result: CreateBillingViewResponseTypeDef = client.create_billing_view(**kwargs)
# ListBillingViewsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_billing.client import BillingClient
from types_boto3_billing.paginator import ListBillingViewsPaginator
from types_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)