mypy-boto3-security-ir Type Annotations

1.42.3 · active · verified Sat Apr 11

This library provides type annotations (stubs) for the `boto3` AWS Security Incident Response service client. It enhances development experience by enabling static type checking with tools like MyPy, catching potential errors early. Currently at version 1.42.3, this package is part of the `mypy-boto3` ecosystem, which generates new versions frequently to keep up with AWS service updates and `boto3` releases.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a `boto3` client for AWS Security Incident Response and type-hint it using `mypy-boto3-security-ir`. It then calls `list_incident_records` with its return type hinted. For actual usage, ensure valid AWS credentials and region are configured.

import boto3
from mypy_boto3_security_ir.client import SecurityIncidentResponseClient
from mypy_boto3_security_ir.type_defs import ListIncidentRecordsOutputTypeDef
import os

# Ensure boto3 is configured, e.g., via environment variables or ~/.aws/credentials
# For demonstration, we'll use a dummy client, but in real-world, provide credentials.
# Boto3 client initialization with type hint
client: SecurityIncidentResponseClient = boto3.client(
    "security-incident-response",
    region_name=os.environ.get('AWS_REGION', 'us-east-1'),
    aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'dummy'),
    aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'dummy'),
)

# Call a method and type hint its output
try:
    response: ListIncidentRecordsOutputTypeDef = client.list_incident_records()
    print("Successfully listed incident records (or empty list if none):", response.get('incidentRecords'))
except Exception as e:
    print(f"An error occurred: {e}")
    print("Please ensure your AWS credentials and region are correctly configured and you have permissions.")

view raw JSON →