Skip to main content

Python SDK for BCM Recommended Actions.

Project description

Getting Started

Installation

pip install aws-sdk-bcm-recommended-actions

Usage

from aws_sdk_bcm_recommended_actions import AsyncBCMRecommendedActionsClient


async def main():
    async with AsyncBCMRecommendedActionsClient() as s3:
        # Example: call the list_recommended_actions operation
        response = await s3.list_recommended_actions()
        print(response["recommended_actions"])

Pagination

Some operations in this SDK support pagination. If the operation supports pagination it will have an iter_ prefixed method that returns an async iterator.

from aws_sdk_bcm_recommended_actions import AsyncBCMRecommendedActionsClient


async def main():
    async with AsyncBCMRecommendedActionsClient() as s3:
        # Example: paginate over list_recommended_actions
        async for item in s3.iter_list_recommended_actions():
            print(item)

Error Handling

The SDK raises exceptions for errors returned by the API. Catch them to handle failures gracefully.

from aws_sdk_bcm_recommended_actions import AsyncBCMRecommendedActionsClient
from aws_sdk_bcm_recommended_actions.error import AccessDeniedException


async def main():
    async with AsyncBCMRecommendedActionsClient() as s3:
        try:
            await s3.list_recommended_actions()
        except AccessDeniedException as e:
            print(f"Error: {e}")
            print(e.data)  # additional error data

Retrying

The SDK retries failed operations automatically. Retry behaviour follows the Smithy specification: errors are retried based on their is_retryable and is_throttling_error attributes. Throttling errors use a longer base delay. Network-level failures (connection errors and timeouts) are also retried. Non-retryable errors, such as client errors without the @retryable trait, are raised immediately without further attempts.

The number of attempts defaults to 3 and can be changed at the client level via retry_max_attempts, or per call via config_overrides.

from aws_sdk_bcm_recommended_actions import AsyncBCMRecommendedActionsClient


async def main():
    async with AsyncBCMRecommendedActionsClient() as s3:
        # Default: 3 attempts for every operation
        response = await s3.list_recommended_actions()

        # Override per operation
        response = await s3.list_recommended_actions(config_overrides={"retry_max_attempts": 5})

        # Disable retries for this call
        response = await s3.list_recommended_actions(config_overrides={"retry_max_attempts": 1})

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_sdk_bcm_recommended_actions-0.1.0.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_sdk_bcm_recommended_actions-0.1.0-py3-none-any.whl (51.6 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page