Skip to main content

Facet Terminal Python SDK — typed client generated from openapi/openapi.yaml plus an ergonomic discovery + auth wrapper.

Project description

facet-sdk (Python)

Python SDK for the Facet Terminal — the per-merchant HTTP contract that every Facet deployment exposes.

The typed request/response surface is generated from openapi/openapi.yaml via openapi-python-client. A thin ergonomic wrapper at facet_sdk provides defaults (User-Agent, timeout) and an authenticated-client factory.

Phase 8 of openapi-as-contract. The wire surface is spec-driven — never edit src/facet_terminal_client/ by hand. Run bash scripts/regenerate.sh after scripts/build-openapi.sh to pull in the latest spec.

Install

pip install facet-sdk

Quickstart

from facet_sdk import create_terminal_client
from facet_terminal_client.api.protocol_core import get_health, get_capabilities

client = create_terminal_client("https://terminal.facet.llc")

health = get_health.sync(client=client)
# `health` is a HealthResponse, a FacetErrorEnvelope, or None

caps = get_capabilities.sync(client=client)

Authenticated calls (KYA token)

Endpoints in the four-verb commerce primitive surface (search, quote, reserve, settle) and most tool surfaces require a KYA bearer token:

from facet_sdk import create_terminal_client
from facet_terminal_client.api.protocol_core import quote
from facet_terminal_client.models import QuoteRequest

client = create_terminal_client(
    "https://terminal.facet.llc",
    kya_token="kya-bearer-from-skyfire-or-similar",
)

resp = quote.sync(client=client, body=QuoteRequest(sku="abc", quantity=1))

Architecture

Layer Module What it is
Ergonomic helpers facet_sdk Hand-written wrappers (create_terminal_client). Stable API.
Typed wire surface facet_terminal_client.api.* Auto-generated per-endpoint functions. Do not edit.
Typed schemas facet_terminal_client.models.* Auto-generated attrs classes for every components.schemas.*. Do not edit.
Generated client facet_terminal_client.Client / AuthenticatedClient Auto-generated httpx-backed dispatch class.

Regenerating from the spec

# Prerequisite: openapi-python-client on PATH
pipx install openapi-python-client==0.28.4

# Regenerate just sdk-python:
bash packages/sdk-python/scripts/regenerate.sh

# Or regenerate all three language SDKs from the spec:
bash scripts/regenerate-sdks.sh

The regen scripts are idempotent — running twice produces no diff unless openapi/openapi.yaml changed.

Tests

# Unit tests (offline):
pip install -e .[dev]
pytest

# Smoke tests against a live Facet Terminal (gated by marker):
pytest -m smoke

# Override the smoke target:
FACET_SMOKE_BASE_URL=https://my-merchant.example.com pytest -m smoke

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

facet_sdk-0.1.0.tar.gz (94.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

facet_sdk-0.1.0-py3-none-any.whl (347.4 kB view details)

Uploaded Python 3

File details

Details for the file facet_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: facet_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 94.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for facet_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2feeafdad44851b3be36cf434ee5e99b829121cb9d930e7aa1a8071e875e8dd4
MD5 6892488cc03dc13e9e9e294035b055e2
BLAKE2b-256 43d378ff26bc5e70e70837fa786cb885467afba4f1dff830648bb31338596539

See more details on using hashes here.

Provenance

The following attestation bundles were made for facet_sdk-0.1.0.tar.gz:

Publisher: publish-sdks.yml on lynz-tonomi/facet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file facet_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: facet_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 347.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for facet_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51dd2849462471fbdd227e490d46552b15663c87320955c34ef8d0be088f3f52
MD5 d77904be3810164af00750dd62d30308
BLAKE2b-256 1715f0fc9c1abcec489641336766962c34e59c9756946d81e0a4bf53ddc4492f

See more details on using hashes here.

Provenance

The following attestation bundles were made for facet_sdk-0.1.0-py3-none-any.whl:

Publisher: publish-sdks.yml on lynz-tonomi/facet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page