Examples#
Index > SecretsManager > Examples
Auto-generated documentation for SecretsManager type annotations stubs module types-boto3-secretsmanager.
Client#
Implicit type annotations#
Can be used with types-boto3[secretsmanager]
package installed.
Write your SecretsManager
code as usual,
type checking and code completion should work out of the box.
# SecretsManagerClient usage example
from boto3.session import Session
session = Session()
client = session.client("secretsmanager") # (1)
result = client.batch_get_secret_value() # (2)
- client: SecretsManagerClient
- result: BatchGetSecretValueResponseTypeDef
# ListSecretsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("secretsmanager") # (1)
paginator = client.get_paginator("list_secrets") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: SecretsManagerClient
- paginator: ListSecretsPaginator
- item: ListSecretsResponseTypeDef
Explicit type annotations#
With types-boto3-lite[secretsmanager]
or a standalone types_boto3_secretsmanager
package, you have to explicitly specify client: SecretsManagerClient
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.
# SecretsManagerClient usage example with type annotations
from boto3.session import Session
from types_boto3_secretsmanager.client import SecretsManagerClient
from types_boto3_secretsmanager.type_defs import BatchGetSecretValueResponseTypeDef
from types_boto3_secretsmanager.type_defs import BatchGetSecretValueRequestRequestTypeDef
session = Session()
client: SecretsManagerClient = session.client("secretsmanager")
kwargs: BatchGetSecretValueRequestRequestTypeDef = {...}
result: BatchGetSecretValueResponseTypeDef = client.batch_get_secret_value(**kwargs)
# ListSecretsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_secretsmanager.client import SecretsManagerClient
from types_boto3_secretsmanager.paginator import ListSecretsPaginator
from types_boto3_secretsmanager.type_defs import ListSecretsResponseTypeDef
session = Session()
client: SecretsManagerClient = session.client("secretsmanager")
paginator: ListSecretsPaginator = client.get_paginator("list_secrets")
for item in paginator.paginate(...):
item: ListSecretsResponseTypeDef
print(item)