mypy-boto3-importexport

1.42.3 · active · verified Sat Apr 11

mypy-boto3-importexport provides type annotations for the AWS SDK for Python (boto3) ImportExport service. These type stubs enhance code completion, static analysis, and error detection for boto3 usage with tools like mypy, PyCharm, and VSCode. It is automatically generated by mypy-boto3-builder and is regularly updated to stay in sync with new boto3 releases and AWS API changes.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize a typed `ImportExportClient` and use it to list jobs with proper type annotations, enabling static analysis and IDE auto-completion. It explicitly types the client and uses `JobTypeDef` for response typing. Remember to have AWS credentials configured (e.g., via environment variables or `~/.aws/credentials`).

import boto3
from mypy_boto3_importexport import ImportExportClient
from mypy_boto3_importexport.type_defs import JobTypeDef, ArtifactTypeDef


def get_import_export_client() -> ImportExportClient:
    """Returns a typed ImportExport client."""
    # Actual credentials will be picked up by boto3 from environment variables or AWS config
    session = boto3.Session(region_name="us-east-1")
    return session.client("importexport")


def list_jobs(client: ImportExportClient) -> list[JobTypeDef]:
    """Lists ImportExport jobs."""
    response = client.list_jobs(MaxJobs=5)
    return response.get("Jobs", [])


if __name__ == "__main__":
    client = get_import_export_client()
    jobs = list_jobs(client)
    if jobs:
        print(f"Found {len(jobs)} ImportExport jobs:")
        for job in jobs:
            print(f"  Job ID: {job.get('JobId')}, Type: {job.get('JobType')}, Status: {job.get('JobStatus')}")
    else:
        print("No ImportExport jobs found.")

view raw JSON →