Skip to content

Examples#

Index > Mediapackagev2 > Examples

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

Client#

Implicit type annotations#

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

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

Client method usage example#

# 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

Paginator usage example#

# 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

Waiter usage example#

# HarvestJobFinishedWaiter usage example

from boto3.session import Session


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

waiter = client.get_waiter("harvest_job_finished")  # (2)
waiter.wait(...)
  1. client: Mediapackagev2Client
  2. waiter: HarvestJobFinishedWaiter

Explicit type annotations#

With types-boto3-lite[mediapackagev2] or a standalone types_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.

Client method usage example#

# Mediapackagev2Client usage example with type annotations

from boto3.session import Session

from types_boto3_mediapackagev2.client import Mediapackagev2Client
from types_boto3_mediapackagev2.type_defs import CreateChannelResponseTypeDef
from types_boto3_mediapackagev2.type_defs import CreateChannelRequestTypeDef


session = Session()

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

kwargs: CreateChannelRequestTypeDef = {...}
result: CreateChannelResponseTypeDef = client.create_channel(**kwargs)

Paginator usage example#

# ListChannelGroupsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_mediapackagev2.client import Mediapackagev2Client
from types_boto3_mediapackagev2.paginator import ListChannelGroupsPaginator
from types_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)

Waiter usage example#

# HarvestJobFinishedWaiter usage example with type annotations

from boto3.session import Session

from types_boto3_mediapackagev2.client import Mediapackagev2Client
from types_boto3_mediapackagev2.waiter import HarvestJobFinishedWaiter

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

waiter: HarvestJobFinishedWaiter = client.get_waiter("harvest_job_finished")
waiter.wait(...)