Skip to main content

apifacts-pytest

A pytest plugin for the apifacts registry: when a test fails on an HTTP error from a registered API, the failure report gets a section with the verified facts about that error and their typed fixes. Zero tokens and zero requests until a test fails.

pip install apifacts-pytest      # loads automatically; or: pytest -p apifacts
──────────── Known facts (apifacts, CC BY 4.0) ────────────
POST api.stripe.com/v1/payment_intents → 400 idempotency_error
✅ verified:server:prod · Reusing an Idempotency-Key with a different request body returns HTTP 400 …
   fix: Send header Idempotency-Key = new UUID per distinct request
   https://github.com/Illouminus/apifacts/blob/main/pages/stripe/idempotency-key-reuse-different-params.md

What it reads and sends

  • Recognized exceptions anywhere in the chain (__cause__, __context__, exception groups): requests.HTTPError, httpx.HTTPStatusError, and SDK errors carrying status_code/http_status and request.url (OpenAI, Anthropic and similar clients).
  • Nothing is sent unless the host is in the registry's service list (GET /v0/services, cached 24 h in ~/.cache/apifacts/). Then one POST /v0/check per distinct failure, 2 s timeout, at most 20 per session; none on a pass; the first network failure turns the plugin off for the session.
  • Sent: method, scheme://host/path (no query, fragment, credentials or port; secret-looking path segments and tenant subdomains replaced), status, the first 2 KB of the error body with secrets, e-mail addresses, long ids and URL query strings removed, and the vendor SDK name and version. Never sent: request bodies, headers, cookies, tokens.
  • Any plugin error is swallowed: it never changes a test outcome.

Configuration

Setting Effect
APIFACTS_DISABLE=1 or -p no:apifacts off
APIFACTS_ENDPOINT registry URL (default https://apifacts.dev)
--apifacts-offline no network: answer from the snapshot shipped in the package
APIFACTS_SNAPSHOT=<dir> snapshot directory (services/*.yaml, facts/*/*.yaml) for offline mode

Code MIT; facts CC BY 4.0.

Metadata

Release files for apifacts-pytest 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apifacts-pytest 0.1.0
File Size Uploaded Provenance
apifacts_pytest-0.1.0.tar.gz 79.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for apifacts-pytest 0.1.0
File Interpreter ABI Platform
apifacts_pytest-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 86.7 kB

Release files / apifacts_pytest-0.1.0.tar.gz

Download URL apifacts_pytest-0.1.0.tar.gz
Size 79.8 kB
Tags Source
SHA-256 checksum
How to use checksums
973b5430d7088fb60a12243c77eb2730a7ab26c5b5a14ec8854e4a4038f930f3
BLAKE2b-256 checksum
How to use checksums
6684a3009ab2f01021df1ae7eeeac00cd1fb0cf7c44df4aa8ccfbd10497da402
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / apifacts_pytest-0.1.0-py3-none-any.whl

Download URL apifacts_pytest-0.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fac418c60320c653b7a034ae1c73d7bf1b7b090f798780a6e6900b5dd2b7db0d
BLAKE2b-256 checksum
How to use checksums
aea46e87b6316823272fd52ca8dc31cc59e1513e70e141039ffa26c762493ce0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for apifacts-pytest 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page