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