mypy-boto3-frauddetector type stubs

1.42.3 · active · verified Sat Apr 11

mypy-boto3-frauddetector provides comprehensive type annotations for the `boto3` AWS FraudDetector service. Generated by `mypy-boto3-builder`, it offers static type checking for clients, resources, paginators, and waiters, significantly improving developer experience with tools like Mypy, Pyright, VSCode, and PyCharm. The library is actively maintained, with frequent updates aligning with `boto3` and `botocore` releases.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize a FraudDetector client with explicit type annotations and make a simple API call (`get_event_types`). The `TYPE_CHECKING` guard ensures the type stub package is only imported for static analysis, avoiding a runtime dependency. Replace `DUMMY_KEY` and `DUMMY_SECRET` with actual credentials or ensure standard AWS credential providers are configured.

import os
from typing import TYPE_CHECKING
from boto3.session import Session

# Only import type stubs during type checking
if TYPE_CHECKING:
    from mypy_boto3_frauddetector import FraudDetectorClient
    from mypy_boto3_frauddetector.type_defs import GetEventTypesResultTypeDef

# Instantiate a boto3 session (credentials are handled by boto3's default chain)
session = Session(
    aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY'),
    aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET'),
    region_name=os.environ.get('AWS_DEFAULT_REGION', 'us-east-1')
)

# Get the FraudDetector client with type annotations
client: 'FraudDetectorClient' = session.client("frauddetector")

try:
    # Example API call with type-hinted response
    response: 'GetEventTypesResultTypeDef' = client.get_event_types()
    print("Successfully retrieved FraudDetector event types.")
    for event_type in response.get('EventTypes', []):
        print(f" - Event Type: {event_type.get('Name')}")
except Exception as e:
    print(f"Error retrieving FraudDetector event types: {e}")

view raw JSON →