mypy-boto3-codestar-notifications Type Stubs

1.42.3 · active · verified Sat Apr 11

mypy-boto3-codestar-notifications provides comprehensive type annotations for the `boto3` client for AWS CodeStar Notifications service. It helps developers leverage static analysis tools like Mypy to catch type-related errors in their AWS SDK code. The library's current version is 1.42.3, and it is released frequently, tracking updates to `boto3` and the `mypy-boto3-builder`.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-hinted CodeStar Notifications client and make a simple API call (`list_notification_rules`) with type-checked results. Remember to configure your AWS credentials for `boto3` to function at runtime.

import boto3
from mypy_boto3_codestar_notifications import CodeStarNotificationsClient
from mypy_boto3_codestar_notifications.type_defs import ListNotificationRulesResultTypeDef

# A boto3 session for runtime (not type-checked)
session = boto3.Session(region_name="us-east-1")

# Get a type-hinted CodeStarNotifications client
client: CodeStarNotificationsClient = session.client("codestar-notifications")

# Example API call with type-checked result
try:
    result: ListNotificationRulesResultTypeDef = client.list_notification_rules()
    print(f"Found {len(result.get('NotificationRules', []))} notification rules.")

    # For demonstration, typically you'd iterate or check the rules
    if result.get('NotificationRules'):
        first_rule_name = result['NotificationRules'][0]['Name']
        print(f"First rule name: {first_rule_name}")
except Exception as e:
    print(f"Error listing notification rules: {e}")

view raw JSON →