mypy-boto3-partnercentral-benefits

1.42.3 · active · verified Sat Apr 11

mypy-boto3-partnercentral-benefits provides comprehensive type annotations for the `boto3` PartnerCentralBenefits service. It enhances development with static type checking and improved autocomplete in IDEs for `boto3` clients, paginators, and specific type definitions. Part of the `mypy-boto3-builder` project, this library is frequently updated to stay synchronized with `boto3` releases. The current version is 1.42.3.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize a `PartnerCentralBenefitsClient` with explicit type annotation, enabling static type checking and IDE autocompletion for its methods and arguments. It then calls `list_partner_benefits` to retrieve and print a summary of benefits. Ensure `boto3` is installed alongside `mypy-boto3-partnercentral-benefits`.

import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_partnercentral_benefits.client import PartnerCentralBenefitsClient


def get_benefits_summary():
    # The stubs provide type hints; boto3 itself performs the AWS API calls.
    client: PartnerCentralBenefitsClient = boto3.client(
        "partnercentral-benefits",
        region_name="us-east-1",
        aws_access_key_id="test", # Replace with actual credentials or env vars
        aws_secret_access_key="test"
    )

    try:
        response = client.list_partner_benefits(MaxResults=10)
        print("Successfully listed partner benefits.")
        for benefit in response.get("PartnerBenefitSummaries", []):
            print(f"- Benefit ID: {benefit.get('BenefitId')}, Status: {benefit.get('Status')}")
    except Exception as e:
        print(f"Error listing partner benefits: {e}")


if __name__ == "__main__":
    get_benefits_summary()

view raw JSON →