Examples#
Auto-generated documentation for Pricing type annotations stubs module types-boto3-pricing.
Client#
Implicit type annotations#
Can be used with types-boto3[pricing]
package installed.
Write your Pricing
code as usual,
type checking and code completion should work out of the box.
# PricingClient usage example
from boto3.session import Session
session = Session()
client = session.client("pricing") # (1)
result = client.describe_services() # (2)
- client: PricingClient
- result: DescribeServicesResponseTypeDef
# 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 types-boto3-lite[pricing]
or a standalone types_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.
# PricingClient usage example with type annotations
from boto3.session import Session
from types_boto3_pricing.client import PricingClient
from types_boto3_pricing.type_defs import DescribeServicesResponseTypeDef
from types_boto3_pricing.type_defs import DescribeServicesRequestRequestTypeDef
session = Session()
client: PricingClient = session.client("pricing")
kwargs: DescribeServicesRequestRequestTypeDef = {...}
result: DescribeServicesResponseTypeDef = client.describe_services(**kwargs)
# DescribeServicesPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_pricing.client import PricingClient
from types_boto3_pricing.paginator import DescribeServicesPaginator
from types_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)