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-aioboto3[mediapackagev2] package installed.

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

# mediapackagev2Client usage example

from aioboto3.session import Session


session = Session()

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

from aioboto3.session import Session


session = Session()

async with session.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-aioboto3-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 aioboto3.session import 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 = Session()

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

from aioboto3.session import Session

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


session = Session()

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