mypy-boto3-workspaces-web type stubs

1.42.51 · active · verified Sat Apr 11

mypy-boto3-workspaces-web provides type annotations for the `boto3` WorkSpacesWeb service. It is part of the `mypy-boto3` family of packages, generated by `mypy-boto3-builder`. These stubs enhance developer experience with static type checking and IDE autocomplete for `boto3` clients. The current version is 1.42.51, reflecting the `boto3` version it types, and it follows a continuous release cadence in sync with `boto3` updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-hinted `boto3` WorkSpacesWeb client and use it with `mypy-boto3-workspaces-web` stubs. It showcases importing the client type and a `TypeDef` for a response, and importantly uses `if TYPE_CHECKING:` to avoid runtime dependencies on the stub package. Remember to configure your AWS credentials for the code to run successfully.

import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_workspaces_web.client import WorkSpacesWebClient
    from mypy_boto3_workspaces_web.type_defs import ListBrowserSettingsResponseTypeDef

def get_workspaces_web_client() -> 'WorkSpacesWebClient':
    """Returns a typed boto3 WorkSpacesWeb client."""
    return boto3.client("workspaces-web")

def list_browser_settings_typed() -> ListBrowserSettingsResponseTypeDef:
    """Lists WorkSpaces Web browser settings with type hints."""
    client: WorkSpacesWebClient = get_workspaces_web_client()
    response = client.list_browser_settings()
    print(f"Found {len(response.get('browserSettings', []))} browser settings.")
    return response

if __name__ == "__main__":
    # This part requires AWS credentials configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
    # It will attempt to call the AWS API.
    try:
        list_browser_settings_typed()
    except Exception as e:
        print(f"An error occurred: {e}. Ensure AWS credentials are configured and WorkSpaces Web service is available.")

view raw JSON →