mypy-boto3-networkflowmonitor Type Stubs

1.42.3 · active · verified Sat Apr 11

mypy-boto3-networkflowmonitor provides precise type annotations for the `boto3` client and resources related to the AWS NetworkFlowMonitor service. It ensures that `boto3` interactions are type-checked by tools like `mypy`, preventing common runtime errors. The current version is `1.42.3`, and new versions are frequently released in sync with `boto3`/`botocore` updates and `mypy-boto3-builder` enhancements.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a `boto3` client for NetworkFlowMonitor and use the type stubs for improved static analysis with `mypy`. After installing, run this code (ensure AWS credentials are set up for `boto3`) and then run `mypy your_script_name.py` to see the type checking in action.

import boto3
from mypy_boto3_networkflowmonitor import NetworkFlowMonitorClient
from typing import TYPE_CHECKING

# Only import TypeDefs if you need them for specific annotations
if TYPE_CHECKING:
    from mypy_boto3_networkflowmonitor.type_defs import (
        ListNetworkFlowMonitorsOutputTypeDef,
    )

def list_monitors():
    # Instantiate the boto3 client, annotated with the stub type
    client: NetworkFlowMonitorClient = boto3.client("network-flow-monitor")

    # The 'response' object will now have type hints based on the stub
    # For a real scenario, you might add error handling.
    response = client.list_network_flow_monitors()

    print(f"Found {len(response['NetworkFlowMonitorList'])} network flow monitors:")
    for monitor in response['NetworkFlowMonitorList']:
        print(f"  - ARN: {monitor['NetworkFlowMonitorArn']}, Status: {monitor['Status']}")

if __name__ == "__main__":
    # Ensure AWS credentials are configured for boto3
    # (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, or ~/.aws/credentials)
    list_monitors()

view raw JSON →