Skip to content

Examples#

Index > MediaLive > Examples

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

Client#

Implicit type annotations#

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

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

# MediaLiveClient usage example

from boto3.session import Session


session = Session()

client = session.client("medialive")  # (1)
result = client.batch_delete()  # (2)
  1. client: MediaLiveClient
  2. result: BatchDeleteResponseTypeDef
# DescribeSchedulePaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("describe_schedule")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: MediaLiveClient
  2. paginator: DescribeSchedulePaginator
  3. item: DescribeScheduleResponsePaginatorTypeDef
# ChannelCreatedWaiter usage example

from boto3.session import Session


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

waiter = client.get_waiter("channel_created")  # (2)
waiter.wait()
  1. client: MediaLiveClient
  2. waiter: ChannelCreatedWaiter

Explicit type annotations#

With boto3-stubs-lite[medialive] or a standalone mypy_boto3_medialive package, you have to explicitly specify client: MediaLiveClient 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.

# MediaLiveClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_medialive.client import MediaLiveClient
from mypy_boto3_medialive.type_defs import BatchDeleteResponseTypeDef
from mypy_boto3_medialive.type_defs import BatchDeleteRequestRequestTypeDef


session = Session()

client: MediaLiveClient = session.client("medialive")

kwargs: BatchDeleteRequestRequestTypeDef = {...}
result: BatchDeleteResponseTypeDef = client.batch_delete(**kwargs)
# DescribeSchedulePaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_medialive.client import MediaLiveClient
from mypy_boto3_medialive.paginator import DescribeSchedulePaginator
from mypy_boto3_medialive.type_defs import DescribeScheduleResponsePaginatorTypeDef


session = Session()
client: MediaLiveClient = session.client("medialive")

paginator: DescribeSchedulePaginator = client.get_paginator("describe_schedule")
for item in paginator.paginate(...):
    item: DescribeScheduleResponsePaginatorTypeDef
    print(item)
# ChannelCreatedWaiter usage example with type annotations

from boto3.session import Session

from mypy_boto3_medialive.client import MediaLiveClient
from mypy_boto3_medialive.waiter import ChannelCreatedWaiter

session = Session()
client: MediaLiveClient = session.client("medialive")

waiter: ChannelCreatedWaiter = client.get_waiter("channel_created")
waiter.wait()