Type Annotations for boto3 CloudWatch Network Monitor

1.42.3 · active · verified Sat Apr 11

mypy-boto3-networkmonitor provides comprehensive type annotations for the `boto3` CloudWatch Network Monitor service (version 1.42.3). Generated by `mypy-boto3-builder` 8.12.0, it enhances developer experience by enabling static type checking with tools like mypy and pyright, and improving code completion in IDEs like VSCode and PyCharm. This library helps to proactively identify and fix potential type-related bugs in `boto3` code at development time.

Warnings

Install

Imports

Quickstart

This example demonstrates how to obtain a type-annotated `NetworkMonitorClient` from a `boto3` session and use it to call an API method. Type annotations ensure that `client` methods and their arguments are correctly validated by a static type checker.

import os
import boto3
from boto3.session import Session
from mypy_boto3_networkmonitor.client import NetworkMonitorClient

def get_network_monitor_client() -> NetworkMonitorClient:
    # Assuming AWS credentials are set via environment variables or AWS CLI config
    session = Session(region_name=os.environ.get('AWS_DEFAULT_REGION', 'us-east-1'))
    client: NetworkMonitorClient = session.client("networkmonitor")
    return client

client = get_network_monitor_client()
response = client.list_monitors()
print(response.get('Monitors'))

view raw JSON →