AdapterOrCallable

Configuration descriptor that accepts an Adapter instance or a callable.

  1. Overview
  2. adapter_type
  3. default

Overview

An Adapter instance (or subclass instance) provides protocol methods for handling specific concerns (URL routing, pagination extraction, etc.).

A plain callable with compatible signature may be supplied for simple cases where the same logic applies uniformly.

Example — adapter instance::

backend = clearskies.backends.ApiBackend(
    base_url="https://api.example.com",
    url_adapter=MyUrlAdapter(),
)

Example — inline callable::

backend = clearskies.backends.ApiBackend(
    base_url="https://api.example.com",
    url_adapter=lambda query: f"/api/{query.model_class.destination_name()}",
)

adapter_type

Required

default

Optional