Examples#
Index > CloudFront > Examples
Auto-generated documentation for CloudFront type annotations stubs module mypy-boto3-cloudfront.
Client#
Implicit type annotations#
Can be used with boto3-stubs[cloudfront]
package installed.
Write your CloudFront
code as usual,
type checking and code completion should work out of the box.
# CloudFrontClient usage example
from boto3.session import Session
session = Session()
client = session.client("cloudfront") # (1)
result = client.associate_alias() # (2)
- client: CloudFrontClient
- result: EmptyResponseMetadataTypeDef
# ListCloudFrontOriginAccessIdentitiesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("cloudfront") # (1)
paginator = client.get_paginator("list_cloud_front_origin_access_identities") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: CloudFrontClient
- paginator: ListCloudFrontOriginAccessIdentitiesPaginator
- item: ListCloudFrontOriginAccessIdentitiesResultTypeDef
# DistributionDeployedWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("cloudfront") # (1)
waiter = client.get_waiter("distribution_deployed") # (2)
waiter.wait()
- client: CloudFrontClient
- waiter: DistributionDeployedWaiter
Explicit type annotations#
With boto3-stubs-lite[cloudfront]
or a standalone mypy_boto3_cloudfront
package, you have to explicitly specify client: CloudFrontClient
type annotation.