Python

The official Python SDK for OpenBotAuth signature verification.

Package: openbotauth-verifierarrow-up-right

Installation

# Core package
pip install openbotauth-verifier

# With FastAPI/Starlette support
pip install openbotauth-verifier[fastapi]

# With Flask support
pip install openbotauth-verifier[flask]

# All extras
pip install openbotauth-verifier[all]

Requirements: Python >= 3.10

Quick Start

FastAPI Middleware

The fastest way to integrate with FastAPI:

Flask Middleware

For Flask applications:

Direct Client Usage

For custom integrations:

API Reference

VerifierClient

Main client class for calling the verifier service.

VerificationRequest

Request data model:

VerificationResult

Response from the verifier:

OBAState

State attached to requests by middleware:

Middleware Configuration

ASGI Middleware (FastAPI/Starlette)

WSGI Middleware (Flask)

Header Utilities

Utility functions for working with RFC 9421 headers:

Security

Sensitive Headers

The SDK automatically blocks sensitive headers from being forwarded to the verifier:

  • cookie

  • authorization

  • proxy-authorization

  • www-authenticate

If a Signature-Input references any of these headers, a ValueError is raised.

Timeout Handling

All verification requests have a configurable timeout (default 5 seconds). On timeout, verification is treated as failed.

Middleware Modes

Observe Mode (Default)

All requests pass through regardless of verification status:

Require-Verified Mode

Returns 401 for unsigned or failed verification:

Error Handling

Type Hints

The package includes full type hints and is compatible with mypy:

Examples

FastAPI with Custom Verifier

Starlette Direct Usage

Flask with Protected Routes

Dependencies

Package
Version
Purpose

httpx

>= 0.25.0

HTTP client (async & sync)

fastapi

>= 0.100

FastAPI framework (optional)

starlette

>= 0.27

ASGI framework (optional)

flask

>= 2.0

Flask framework (optional)

Last updated