Skip to content

Examples#

Index > AppStream > Examples

Auto-generated documentation for AppStream type annotations stubs module mypy-boto3-appstream.

Client#

Implicit type annotations#

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

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

# AppStreamClient usage example

from boto3.session import Session


session = Session()

client = session.client("appstream")  # (1)
result = client.associate_app_block_builder_app_block()  # (2)
  1. client: AppStreamClient
  2. result: AssociateAppBlockBuilderAppBlockResultTypeDef
# DescribeDirectoryConfigsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("describe_directory_configs")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: AppStreamClient
  2. paginator: DescribeDirectoryConfigsPaginator
  3. item: DescribeDirectoryConfigsResultTypeDef
# FleetStartedWaiter usage example

from boto3.session import Session


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

waiter = client.get_waiter("fleet_started")  # (2)
waiter.wait()
  1. client: AppStreamClient
  2. waiter: FleetStartedWaiter

Explicit type annotations#

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

# AppStreamClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_appstream.client import AppStreamClient
from mypy_boto3_appstream.type_defs import AssociateAppBlockBuilderAppBlockResultTypeDef
from mypy_boto3_appstream.type_defs import AssociateAppBlockBuilderAppBlockRequestRequestTypeDef


session = Session()

client: AppStreamClient = session.client("appstream")

kwargs: AssociateAppBlockBuilderAppBlockRequestRequestTypeDef = {...}
result: AssociateAppBlockBuilderAppBlockResultTypeDef = client.associate_app_block_builder_app_block(**kwargs)
# DescribeDirectoryConfigsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_appstream.client import AppStreamClient
from mypy_boto3_appstream.paginator import DescribeDirectoryConfigsPaginator
from mypy_boto3_appstream.type_defs import DescribeDirectoryConfigsResultTypeDef


session = Session()
client: AppStreamClient = session.client("appstream")

paginator: DescribeDirectoryConfigsPaginator = client.get_paginator("describe_directory_configs")
for item in paginator.paginate(...):
    item: DescribeDirectoryConfigsResultTypeDef
    print(item)
# FleetStartedWaiter usage example with type annotations

from boto3.session import Session

from mypy_boto3_appstream.client import AppStreamClient
from mypy_boto3_appstream.waiter import FleetStartedWaiter

session = Session()
client: AppStreamClient = session.client("appstream")

waiter: FleetStartedWaiter = client.get_waiter("fleet_started")
waiter.wait()