Skip to content

Examples#

Index > mediapackagev2 > Examples

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

Client#

Implicit type annotations#

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

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

# mediapackagev2Client usage example

from boto3.session import Session


session = Session()

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

from boto3.session import Session


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

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

Explicit type annotations#

With boto3-stubs-lite[mediapackagev2] or a standalone mypy_boto3_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 boto3.session import Session

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


session = Session()

client: mediapackagev2Client = session.client("mediapackagev2")

kwargs: CreateChannelRequestRequestTypeDef = {...}
result: CreateChannelResponseTypeDef = client.create_channel(**kwargs)
# ListChannelGroupsPaginator usage example with type annotations

from boto3.session import Session

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


session = Session()
client: mediapackagev2Client = session.client("mediapackagev2")

paginator: ListChannelGroupsPaginator = client.get_paginator("list_channel_groups")
for item in paginator.paginate(...):
    item: ListChannelGroupsResponseTypeDef
    print(item)