Skip to content

Examples#

Index > EventBridgeScheduler > Examples

Auto-generated documentation for EventBridgeScheduler type annotations stubs module types-boto3-scheduler.

Client#

Implicit type annotations#

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

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

# EventBridgeSchedulerClient usage example

from boto3.session import Session


session = Session()

client = session.client("scheduler")  # (1)
result = client.create_schedule()  # (2)
  1. client: EventBridgeSchedulerClient
  2. result: CreateScheduleOutputTypeDef
# ListScheduleGroupsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_schedule_groups")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: EventBridgeSchedulerClient
  2. paginator: ListScheduleGroupsPaginator
  3. item: ListScheduleGroupsOutputTypeDef

Explicit type annotations#

With types-boto3-lite[scheduler] or a standalone types_boto3_scheduler package, you have to explicitly specify client: EventBridgeSchedulerClient 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.

# EventBridgeSchedulerClient usage example with type annotations

from boto3.session import Session

from types_boto3_scheduler.client import EventBridgeSchedulerClient
from types_boto3_scheduler.type_defs import CreateScheduleOutputTypeDef
from types_boto3_scheduler.type_defs import CreateScheduleInputRequestTypeDef


session = Session()

client: EventBridgeSchedulerClient = session.client("scheduler")

kwargs: CreateScheduleInputRequestTypeDef = {...}
result: CreateScheduleOutputTypeDef = client.create_schedule(**kwargs)
# ListScheduleGroupsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_scheduler.client import EventBridgeSchedulerClient
from types_boto3_scheduler.paginator import ListScheduleGroupsPaginator
from types_boto3_scheduler.type_defs import ListScheduleGroupsOutputTypeDef


session = Session()
client: EventBridgeSchedulerClient = session.client("scheduler")

paginator: ListScheduleGroupsPaginator = client.get_paginator("list_schedule_groups")
for item in paginator.paginate(...):
    item: ListScheduleGroupsOutputTypeDef
    print(item)