mypy-boto3-partnercentral-selling Type Annotations

1.42.80 · active · verified Sat Apr 11

mypy-boto3-partnercentral-selling provides type annotations for the `boto3` PartnerCentralSellingAPI service. It enables static type checking for `boto3` client calls, methods, and responses, enhancing code reliability and developer experience. The current version is 1.42.80, and it is frequently updated to align with `boto3` and AWS API changes.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-hinted `boto3` client for PartnerCentralSellingAPI and use it. The `mypy-boto3-partnercentral-selling` package provides the necessary type stubs, allowing tools like MyPy to validate your AWS API calls and responses statically.

import boto3
from mypy_boto3_partnercentral_selling.client import PartnerCentralSellingAPIClient
from typing import TYPE_CHECKING

# Recommended: Use TYPE_CHECKING for imports only used by type checkers
if TYPE_CHECKING:
    # Only import if you need specific TypeDefs for complex scenarios
    from mypy_boto3_partnercentral_selling.type_defs import GetPartnerAccountOutputTypeDef

def get_partnercentral_selling_client() -> PartnerCentralSellingAPIClient:
    # boto3.client returns the actual client, which is type-checked by mypy-boto3-*
    return boto3.client("partnercentral-selling")

client: PartnerCentralSellingAPIClient = get_partnercentral_selling_client()

try:
    # Example API call with type-hinted client
    # Replace 'YOUR_PARTNER_ACCOUNT_ID' with a real one for a runnable example
    response = client.get_partner_account(partnerAccountId=os.environ.get('PARTNER_ACCOUNT_ID', 'YOUR_PARTNER_ACCOUNT_ID'))

    print(f"Partner account name: {response.get('partnerAccountName')}")
    print(f"Account status: {response.get('accountStatus')}")

except client.exceptions.ResourceNotFoundException:
    print("Partner account not found.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →