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