Skip to content

Examples#

Index > AppConfig > Examples

Auto-generated documentation for AppConfig type annotations stubs module mypy-boto3-appconfig.

Client#

Implicit type annotations#

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

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

# AppConfigClient usage example

from boto3.session import Session


session = Session()

client = session.client("appconfig")  # (1)
result = client.create_application()  # (2)
  1. client: AppConfigClient
  2. result: ApplicationResponseTypeDef
# ListApplicationsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_applications")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: AppConfigClient
  2. paginator: ListApplicationsPaginator
  3. item: ApplicationsTypeDef

Explicit type annotations#

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

# AppConfigClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_appconfig.client import AppConfigClient
from mypy_boto3_appconfig.type_defs import ApplicationResponseTypeDef
from mypy_boto3_appconfig.type_defs import CreateApplicationRequestRequestTypeDef


session = Session()

client: AppConfigClient = session.client("appconfig")

kwargs: CreateApplicationRequestRequestTypeDef = {...}
result: ApplicationResponseTypeDef = client.create_application(**kwargs)
# ListApplicationsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_appconfig.client import AppConfigClient
from mypy_boto3_appconfig.paginator import ListApplicationsPaginator
from mypy_boto3_appconfig.type_defs import ApplicationsTypeDef


session = Session()
client: AppConfigClient = session.client("appconfig")

paginator: ListApplicationsPaginator = client.get_paginator("list_applications")
for item in paginator.paginate(...):
    item: ApplicationsTypeDef
    print(item)