Skip to content

Examples#

Index > S3Control > Examples

Auto-generated documentation for S3Control type annotations stubs module mypy-boto3-s3control.

Client#

Implicit type annotations#

Can be used with boto3-stubs[s3control] package installed.

Write your S3Control code as usual, type checking and code completion should work out of the box.

# S3ControlClient usage example

from boto3.session import Session


session = Session()

client = session.client("s3control")  # (1)
result = client.associate_access_grants_identity_center()  # (2)
  1. client: S3ControlClient
  2. result: EmptyResponseMetadataTypeDef
# ListAccessPointsForObjectLambdaPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("s3control")  # (1)

paginator = client.get_paginator("list_access_points_for_object_lambda")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: S3ControlClient
  2. paginator: ListAccessPointsForObjectLambdaPaginator
  3. item: ListAccessPointsForObjectLambdaResultTypeDef

Explicit type annotations#

With boto3-stubs-lite[s3control] or a standalone mypy_boto3_s3control package, you have to explicitly specify client: S3ControlClient 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.

# S3ControlClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_s3control.client import S3ControlClient
from mypy_boto3_s3control.type_defs import EmptyResponseMetadataTypeDef
from mypy_boto3_s3control.type_defs import AssociateAccessGrantsIdentityCenterRequestRequestTypeDef


session = Session()

client: S3ControlClient = session.client("s3control")

kwargs: AssociateAccessGrantsIdentityCenterRequestRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.associate_access_grants_identity_center(**kwargs)
# ListAccessPointsForObjectLambdaPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_s3control.client import S3ControlClient
from mypy_boto3_s3control.paginator import ListAccessPointsForObjectLambdaPaginator
from mypy_boto3_s3control.type_defs import ListAccessPointsForObjectLambdaResultTypeDef


session = Session()
client: S3ControlClient = session.client("s3control")

paginator: ListAccessPointsForObjectLambdaPaginator = client.get_paginator("list_access_points_for_object_lambda")
for item in paginator.paginate(...):
    item: ListAccessPointsForObjectLambdaResultTypeDef
    print(item)