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://apifacts.dev/stripe/idempotency-key-reuse-different-params
What it reads and sends
- Recognized exceptions anywhere in the chain (
__cause__,__context__, exception groups):requests.HTTPError,httpx.HTTPStatusError, and SDK errors carryingstatus_code/http_statusandrequest.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 onePOST /v0/checkper 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.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| apifacts_pytest-0.2.0.tar.gz | 79.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apifacts_pytest-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 86.8 kB
Release files / apifacts_pytest-0.2.0.tar.gz
| Download URL | apifacts_pytest-0.2.0.tar.gz |
|---|---|
| Size | 79.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6bf692cef36c8d3358c7392bfa7dd1d6312f0cf2584435af9e2fef6a6bf48e3a
|
|
BLAKE2b-256 checksum How to use checksums |
a23da7fa5acf18c9ac360bfdad7a316f4f0d4ad41f9ecc94a4ae16d5abcb2b7e
|
| 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.2.0-py3-none-any.whl
| Download URL | apifacts_pytest-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d0e950324eca436d8a2f454988e727879af790105820533650aa148b1866ff2
|
|
BLAKE2b-256 checksum How to use checksums |
a59783bab0543e0f4c48bb23083a4e876ff76030245d9f265b5f40968fc9b125
|
| 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.2.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.