Skip to content

Examples#

Index > mediapackagev2 > Examples

Auto-generated documentation for mediapackagev2 type annotations stubs module types-aiobotocore-mediapackagev2.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[mediapackagev2] package installed.

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

# mediapackagev2Client usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("mediapackagev2") as client:  # (1)
    result = await client.create_channel()  # (2)
  1. client: mediapackagev2Client
  2. result: CreateChannelResponseTypeDef
# ListChannelGroupsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("mediapackagev2") as client:  # (1)
    paginator = client.get_paginator("list_channel_groups")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: mediapackagev2Client
  2. paginator: ListChannelGroupsPaginator
  3. item: ListChannelGroupsResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[mediapackagev2] or a standalone types_aiobotocore_mediapackagev2 package, you have to explicitly specify client: mediapackagev2Client 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.

# mediapackagev2Client usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_mediapackagev2.client import mediapackagev2Client
from types_aiobotocore_mediapackagev2.type_defs import CreateChannelResponseTypeDef
from types_aiobotocore_mediapackagev2.type_defs import CreateChannelRequestRequestTypeDef


session = get_session()

async with session.create_client("mediapackagev2") as client:
    client: mediapackagev2Client
    kwargs: CreateChannelRequestRequestTypeDef = {...}
    result: CreateChannelResponseTypeDef = await client.create_channel(**kwargs)
# ListChannelGroupsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_mediapackagev2.client import mediapackagev2Client
from types_aiobotocore_mediapackagev2.paginator import ListChannelGroupsPaginator
from types_aiobotocore_mediapackagev2.type_defs import ListChannelGroupsResponseTypeDef


session = get_session()

async with session.create_client("mediapackagev2") as client:
    client: mediapackagev2Client
    paginator: ListChannelGroupsPaginator = client.get_paginator("list_channel_groups")
    async for item in paginator.paginate(...):
        item: ListChannelGroupsResponseTypeDef
        print(item)