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