mypy-boto3-inspector-scan type stubs

1.42.12 · active · verified Sat Apr 11

mypy-boto3-inspector-scan provides PEP 561 compatible type annotations for the `boto3` AWS SDK's Inspector Scan service. It helps enable static type checking for `boto3` code with tools like MyPy, catching potential errors before runtime. The current version is 1.42.12, generated by `mypy-boto3-builder 8.12.0`. Releases are frequent, typically mirroring `boto3` and AWS service updates.

Warnings

Install

Imports

Quickstart

Demonstrates how to initialize an `inspector-scan` client with `mypy-boto3` type annotations and make a sample API call. This code requires `boto3` to be installed and AWS credentials configured in the environment or AWS config files.

import boto3
from mypy_boto3_inspector_scan.client import InspectorScanClient
import os

# Instantiate a boto3 client with type hints from mypy-boto3-inspector-scan
# Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)
# Using os.environ.get for region to make the example safer without hardcoding
region = os.environ.get('AWS_REGION', 'us-east-1')

try:
    # The type annotation 'InspectorScanClient' provides static type checking benefits
    client: InspectorScanClient = boto3.client("inspector-scan", region_name=region)
    print(f"Successfully created Inspector Scan client in region: {region}")

    # Example: List scans (requires appropriate IAM permissions, such as 'inspector-scan:ListScans')
    response = client.list_scans()
    print("List Scans Response (truncated for brevity):")
    print(response.get('scans', [])[:1]) # Print first scan if available

except Exception as e:
    print(f"An error occurred: {e}")
    print("Please ensure 'boto3' is installed and AWS credentials are configured correctly.")
    print("Also verify your IAM user/role has permissions for 'inspector-scan:ListScans'.")

view raw JSON →