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