Examples#
Auto-generated documentation for Transfer type annotations stubs module types-boto3-transfer.
Client#
Implicit type annotations#
Can be used with types-boto3[transfer]
package installed.
Write your Transfer
code as usual,
type checking and code completion should work out of the box.
# TransferClient usage example
from boto3.session import Session
session = Session()
client = session.client("transfer") # (1)
result = client.create_access() # (2)
- client: TransferClient
- result: CreateAccessResponseTypeDef
# ListAccessesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("transfer") # (1)
paginator = client.get_paginator("list_accesses") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: TransferClient
- paginator: ListAccessesPaginator
- item: ListAccessesResponseTypeDef
# ServerOfflineWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("transfer") # (1)
waiter = client.get_waiter("server_offline") # (2)
waiter.wait()
- client: TransferClient
- waiter: ServerOfflineWaiter
Explicit type annotations#
With types-boto3-lite[transfer]
or a standalone types_boto3_transfer
package, you have to explicitly specify client: TransferClient
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.
# TransferClient usage example with type annotations
from boto3.session import Session
from types_boto3_transfer.client import TransferClient
from types_boto3_transfer.type_defs import CreateAccessResponseTypeDef
from types_boto3_transfer.type_defs import CreateAccessRequestRequestTypeDef
session = Session()
client: TransferClient = session.client("transfer")
kwargs: CreateAccessRequestRequestTypeDef = {...}
result: CreateAccessResponseTypeDef = client.create_access(**kwargs)
# ListAccessesPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_transfer.client import TransferClient
from types_boto3_transfer.paginator import ListAccessesPaginator
from types_boto3_transfer.type_defs import ListAccessesResponseTypeDef
session = Session()
client: TransferClient = session.client("transfer")
paginator: ListAccessesPaginator = client.get_paginator("list_accesses")
for item in paginator.paginate(...):
item: ListAccessesResponseTypeDef
print(item)
# ServerOfflineWaiter usage example with type annotations
from boto3.session import Session
from types_boto3_transfer.client import TransferClient
from types_boto3_transfer.waiter import ServerOfflineWaiter
session = Session()
client: TransferClient = session.client("transfer")
waiter: ServerOfflineWaiter = client.get_waiter("server_offline")
waiter.wait()