mypy-boto3-workdocs Type Annotations

1.42.3 · active · verified Sat Apr 11

mypy-boto3-workdocs provides type annotations for the boto3 WorkDocs service, ensuring static type checking compatibility with tools like mypy, VSCode, and PyCharm. It's automatically generated with mypy-boto3-builder, currently at version 1.42.3, and typically releases in sync with new boto3 and botocore versions.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a WorkDocs client with explicit type annotations for `mypy` using `mypy-boto3-workdocs`. It shows how to obtain a typed client and use a method with its corresponding response type definition. For full functionality, ensure your AWS credentials and WorkDocs Organization ID are configured, e.g., via environment variables.

import boto3
from typing import TYPE_CHECKING
import os

if TYPE_CHECKING:
    from mypy_boto3_workdocs.client import WorkDocsClient
    from mypy_boto3_workdocs.type_defs import DescribeUsersResponseTypeDef


def get_workdocs_client() -> 'WorkDocsClient':
    # In a real application, configure AWS credentials securely.
    # For quickstart, using environment variables.
    session = boto3.Session(
        aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
        aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''),
        region_name=os.environ.get('AWS_DEFAULT_REGION', 'us-east-1')
    )
    return session.client('workdocs')


if __name__ == '__main__':
    client: WorkDocsClient = get_workdocs_client()
    print(f"Client type: {type(client)}")

    # Example: Describe users with explicit type hints
    response: DescribeUsersResponseTypeDef = client.describe_users(
        OrganizationId="your_organization_id" # Replace with actual Organization ID
    )
    print("Successfully described users.")
    print(f"Users: {response.get('Users')}")
    # Note: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION
    # and your_organization_id must be set for this to run successfully.

view raw JSON →