mypy-boto3 Marketplace Entitlement Type Stubs

1.42.58 · active · verified Sat Apr 11

This library provides type annotations (stubs) for the `boto3` Marketplace Entitlement Service, enhancing development experience with static type checking for AWS SDK usage. It's part of the `mypy-boto3` project, which generates stubs for all `boto3` services. The current version is 1.42.58, generated by `mypy-boto3-builder` 8.12.0, with releases closely following `boto3` service updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a `boto3` Marketplace Entitlement client with type annotations and make a sample API call. It shows how to import the specific client type and a common response `TypeDef` for robust type checking. Remember to install `boto3` and `mypy` alongside this stub package. Replace placeholder environment variables with actual values for execution.

import boto3
from mypy_boto3_marketplace_entitlement import MarketplaceEntitlementClient
from mypy_boto3_marketplace_entitlement.type_defs import GetEntitlementsResultTypeDef, GetEntitlementsRequestRequestTypeDef

# Instantiate a boto3 client with type hints
client: MarketplaceEntitlementClient = boto3.client("marketplace-entitlement")

# Example usage with type-hinted parameters and return value
request_params: GetEntitlementsRequestRequestTypeDef = {
    "ProductCode": os.environ.get('MARKETPLACE_PRODUCT_CODE', 'some-product-code'),
    "Filter": {
        "CUSTOMER_IDENTIFIER": [
            os.environ.get('AWS_ACCOUNT_ID', '123456789012')
        ]
    }
}

try:
    response: GetEntitlementsResultTypeDef = client.get_entitlements(**request_params)
    print("Successfully retrieved entitlements:")
    for entitlement in response.get('Entitlements', []):
        print(f"  Entitlement: {entitlement.get('ProductCode')} for {entitlement.get('CustomerIdentifier')}")
except Exception as e:
    print(f"Error retrieving entitlements: {e}")

# To verify with mypy, save this to a file (e.g., `main.py`) and run `mypy main.py`

view raw JSON →