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)
- client: Mediapackagev2Client
- 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)
- client: Mediapackagev2Client
- paginator: ListChannelGroupsPaginator
- item: ListChannelGroupsResponseTypeDef
# 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()
- client: Mediapackagev2Client
- waiter: HarvestJobFinishedWaiter
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)
# HarvestJobFinishedWaiter usage example with type annotations
from boto3.session import Session
from mypy_boto3_mediapackagev2.client import Mediapackagev2Client
from mypy_boto3_mediapackagev2.waiter import HarvestJobFinishedWaiter
session = Session()
client: Mediapackagev2Client = session.client("mediapackagev2")
waiter: HarvestJobFinishedWaiter = client.get_waiter("harvest_job_finished")
waiter.wait()