Examples#
Auto-generated documentation for Backup type annotations stubs module types-aiobotocore-backup.
Client#
Implicit type annotations#
Can be used with types-aiobotocore[backup]
package installed.
Write your Backup
code as usual,
type checking and code completion should work out of the box.
# BackupClient usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("backup") as client: # (1)
result = await client.create_backup_plan() # (2)
- client: BackupClient
- result: CreateBackupPlanOutputTypeDef
# ListBackupJobsPaginator usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("backup") as client: # (1)
paginator = client.get_paginator("list_backup_jobs") # (2)
async for item in paginator.paginate(...):
print(item) # (3)
- client: BackupClient
- paginator: ListBackupJobsPaginator
- item: ListBackupJobsOutputTypeDef
Explicit type annotations#
With types-aiobotocore-lite[backup]
or a standalone types_aiobotocore_backup
package, you have to explicitly specify
client: BackupClient
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.
# BackupClient usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_backup.client import BackupClient
from types_aiobotocore_backup.type_defs import CreateBackupPlanOutputTypeDef
from types_aiobotocore_backup.type_defs import CreateBackupPlanInputRequestTypeDef
session = get_session()
async with session.create_client("backup") as client:
client: BackupClient
kwargs: CreateBackupPlanInputRequestTypeDef = {...}
result: CreateBackupPlanOutputTypeDef = await client.create_backup_plan(**kwargs)
# ListBackupJobsPaginator usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_backup.client import BackupClient
from types_aiobotocore_backup.paginator import ListBackupJobsPaginator
from types_aiobotocore_backup.type_defs import ListBackupJobsOutputTypeDef
session = get_session()
async with session.create_client("backup") as client:
client: BackupClient
paginator: ListBackupJobsPaginator = client.get_paginator("list_backup_jobs")
async for item in paginator.paginate(...):
item: ListBackupJobsOutputTypeDef
print(item)