Skip to content

Examples#

Index > CloudWatchInternetMonitor > Examples

Auto-generated documentation for CloudWatchInternetMonitor type annotations stubs module mypy-boto3-internetmonitor.

Client#

Implicit type annotations#

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

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

# CloudWatchInternetMonitorClient usage example

from boto3.session import Session


session = Session()

client = session.client("internetmonitor")  # (1)
result = client.create_monitor()  # (2)
  1. client: CloudWatchInternetMonitorClient
  2. result: CreateMonitorOutputTypeDef
# ListHealthEventsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_health_events")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: CloudWatchInternetMonitorClient
  2. paginator: ListHealthEventsPaginator
  3. item: ListHealthEventsOutputTypeDef

Explicit type annotations#

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

# CloudWatchInternetMonitorClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_internetmonitor.client import CloudWatchInternetMonitorClient
from mypy_boto3_internetmonitor.type_defs import CreateMonitorOutputTypeDef
from mypy_boto3_internetmonitor.type_defs import CreateMonitorInputRequestTypeDef


session = Session()

client: CloudWatchInternetMonitorClient = session.client("internetmonitor")

kwargs: CreateMonitorInputRequestTypeDef = {...}
result: CreateMonitorOutputTypeDef = client.create_monitor(**kwargs)
# ListHealthEventsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_internetmonitor.client import CloudWatchInternetMonitorClient
from mypy_boto3_internetmonitor.paginator import ListHealthEventsPaginator
from mypy_boto3_internetmonitor.type_defs import ListHealthEventsOutputTypeDef


session = Session()
client: CloudWatchInternetMonitorClient = session.client("internetmonitor")

paginator: ListHealthEventsPaginator = client.get_paginator("list_health_events")
for item in paginator.paginate(...):
    item: ListHealthEventsOutputTypeDef
    print(item)