⚡ docsfy

timeout-sampler

Poll any function until it succeeds or times out, with fine-grained exception handling

Get Started →

Getting Started

Explore →

User Guides

Explore →

Recipes

  • Common Polling Patterns

    Copy-paste recipes for waiting on API readiness, retrying flaky operations, polling with partial functions, and combining exception filters

Explore →

Reference

  • TimeoutSampler API

    Complete constructor parameters, iteration behavior, exception handling methods, and return semantics for TimeoutSampler

  • @retry Decorator API

    All parameters accepted by the retry decorator and how they map to TimeoutSampler options

  • TimeoutWatch API

    Constructor and remaining_time() method reference for the TimeoutWatch time-tracking class

  • TimeoutExpiredError Reference

    Attributes, string representation, and access to last_exp and elapsed_time on the TimeoutExpiredError exception

Explore →

Internals

  • How Exception Matching Works

    Understand the inheritance-aware exception matching algorithm, message filtering, and the three outcome categories when an exception is raised inside the polled function

Explore →

Guides

  • Redacting Sensitive Data from Log Output

    Document the sensitive_keys parameter available on both TimeoutSampler and @retry, explain the built-in default sensitive keys (authorization, token, access_token, password, secret, api_key, apikey), show how to add custom keys via the sensitive_keys parameter, and describe the recursive redaction behavior that masks values in nested dicts, lists, and tuples in logged arguments.

  • Using Callable Exception Filters

    Document the ability to use callable (lambda or function) filters in exceptions_dict values alongside string filters. Cover the ExceptionFilter and ExceptionsDict public type aliases, explain that callables receive the exception instance and return a truthy value to ignore/retry, show examples like filtering by exception attributes (e.g., HTTP status codes), combining string and callable filters in the same list, and describe error handling when a callable filter itself raises.

Explore →
🤖
AI-friendly documentation

This documentation is optimized for AI consumption.