Skip to content

Examples#

Index > UserNotifications > Examples

Auto-generated documentation for UserNotifications type annotations stubs module types-boto3-notifications.

Client#

Implicit type annotations#

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

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

Client method usage example#

# UserNotificationsClient usage example

from boto3.session import Session


session = Session()

client = session.client("notifications")  # (1)
result = client.create_event_rule()  # (2)
  1. client: UserNotificationsClient
  2. result: CreateEventRuleResponseTypeDef

Paginator usage example#

# ListChannelsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_channels")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: UserNotificationsClient
  2. paginator: ListChannelsPaginator
  3. item: ListChannelsResponseTypeDef

Explicit type annotations#

With types-boto3-lite[notifications] or a standalone types_boto3_notifications package, you have to explicitly specify client: UserNotificationsClient 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#

# UserNotificationsClient usage example with type annotations

from boto3.session import Session

from types_boto3_notifications.client import UserNotificationsClient
from types_boto3_notifications.type_defs import CreateEventRuleResponseTypeDef
from types_boto3_notifications.type_defs import CreateEventRuleRequestTypeDef


session = Session()

client: UserNotificationsClient = session.client("notifications")

kwargs: CreateEventRuleRequestTypeDef = {...}
result: CreateEventRuleResponseTypeDef = client.create_event_rule(**kwargs)

Paginator usage example#

# ListChannelsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_notifications.client import UserNotificationsClient
from types_boto3_notifications.paginator import ListChannelsPaginator
from types_boto3_notifications.type_defs import ListChannelsResponseTypeDef


session = Session()
client: UserNotificationsClient = session.client("notifications")

paginator: ListChannelsPaginator = client.get_paginator("list_channels")
for item in paginator.paginate(...):
    item: ListChannelsResponseTypeDef
    print(item)