Type Annotations for boto3 NetworkManager

1.42.3 · active · verified Sat Apr 11

mypy-boto3-networkmanager provides type annotations for the `boto3` NetworkManager service. It is part of the `mypy-boto3` project, generated by `mypy-boto3-builder`, ensuring static type checking for the AWS SDK for Python (Boto3). It helps catch API usage errors at development time. The current version is 1.42.3 and new versions are frequently released to align with `boto3` updates and `mypy-boto3-builder` improvements.

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use the `NetworkManagerClient` type hint with a standard `boto3` client. This allows MyPy to validate method calls and arguments, ensuring type safety for your AWS interactions.

import boto3
from mypy_boto3_networkmanager import NetworkManagerClient

def list_all_core_networks() -> None:
    # Initialize the client with type hinting
    client: NetworkManagerClient = boto3.client("networkmanager")

    print("Listing Core Networks...")
    try:
        response = client.list_core_networks()
        core_networks = response.get("CoreNetworks", [])
        if core_networks:
            for cn in core_networks:
                print(f"  - {cn.get('CoreNetworkId')} ({cn.get('State')})")
        else:
            print("  No Core Networks found.")
    except Exception as e:
        print(f"An error occurred: {e}")

if __name__ == "__main__":
    list_all_core_networks()

view raw JSON →