mypy-boto3-quicksight Type Stubs

1.42.80 · active · verified Sat Apr 11

mypy-boto3-quicksight provides static type annotations for the boto3 QuickSight service, generated by mypy-boto3-builder. It enhances development with type-checking capabilities for QuickSight operations. The library is actively maintained with frequent updates, often aligning with new boto3 releases and builder improvements. Current version is 1.42.80.

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use `QuickSightClient` to type-hint a `boto3` QuickSight client. This enables static analysis tools like MyPy to validate your QuickSight API calls. For the code to execute successfully, ensure your AWS credentials are configured and replace `AWS_ACCOUNT_ID` with a real value from your environment or directly in the code.

import boto3
from mypy_boto3_quicksight.client import QuickSightClient
from typing import TYPE_CHECKING
import os

# Ensure boto3 is installed for runtime functionality
# pip install boto3 mypy-boto3-quicksight

if TYPE_CHECKING:
    # Type-hint the boto3 client for QuickSight
    client: QuickSightClient = boto3.client("quicksight")
else:
    client = boto3.client("quicksight")

# Example: List dashboards (requires AWS credentials configured)
try:
    print("Attempting to list QuickSight dashboards...")
    # Replace '123456789012' with your actual AWS Account ID or set AWS_ACCOUNT_ID env var.
    aws_account_id = os.environ.get('AWS_ACCOUNT_ID', '123456789012')
    
    response = client.list_dashboards(
        AwsAccountId=aws_account_id
    )
    dashboards = response.get("DashboardSummaryList", [])
    if dashboards:
        print(f"Found {len(dashboards)} dashboards. First dashboard name: {dashboards[0].get('Name')}")
    else:
        print(f"No dashboards found for AWS Account ID: {aws_account_id}, or the ID is invalid.")
except Exception as e:
    print(f"An error occurred: {e}")

print("QuickSight client setup with type hints successful.")

view raw JSON →