Skip to content

Examples#

Index > BackupSearch > Examples

Auto-generated documentation for BackupSearch type annotations stubs module mypy-boto3-backupsearch.

Client#

Implicit type annotations#

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

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

# BackupSearchClient usage example

from boto3.session import Session


session = Session()

client = session.client("backupsearch")  # (1)
result = client.get_search_job()  # (2)
  1. client: BackupSearchClient
  2. result: GetSearchJobOutputTypeDef
# ListSearchJobBackupsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_search_job_backups")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: BackupSearchClient
  2. paginator: ListSearchJobBackupsPaginator
  3. item: ListSearchJobBackupsOutputTypeDef

Explicit type annotations#

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

# BackupSearchClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_backupsearch.client import BackupSearchClient
from mypy_boto3_backupsearch.type_defs import GetSearchJobOutputTypeDef
from mypy_boto3_backupsearch.type_defs import GetSearchJobInputRequestTypeDef


session = Session()

client: BackupSearchClient = session.client("backupsearch")

kwargs: GetSearchJobInputRequestTypeDef = {...}
result: GetSearchJobOutputTypeDef = client.get_search_job(**kwargs)
# ListSearchJobBackupsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_backupsearch.client import BackupSearchClient
from mypy_boto3_backupsearch.paginator import ListSearchJobBackupsPaginator
from mypy_boto3_backupsearch.type_defs import ListSearchJobBackupsOutputTypeDef


session = Session()
client: BackupSearchClient = session.client("backupsearch")

paginator: ListSearchJobBackupsPaginator = client.get_paginator("list_search_job_backups")
for item in paginator.paginate(...):
    item: ListSearchJobBackupsOutputTypeDef
    print(item)