CodeSampleX

Beispiel

Register synchronous and asynchronous request and response event hooks in httpx Client and AsyncClient to transform headers, validate status codes, and intercept multi-hop redirects

sha256:ea1289d4bc2800cdbe3b026602eee3815cdb092af97368a24035055fb071d34f

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung python linux 24 · ubuntu · glibc 2.39 x64 python python pip

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
python 3.12 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1python:3.12-alpine@sha256:d09d15e60962…
2026-08-28

Fall

HOW
Ziel
Register synchronous and asynchronous request and response event hooks in httpx Client and AsyncClient to transform headers, validate status codes, and intercept multi-hop redirects
Pakete
Symbole
  • httpx.AsyncClient
  • httpx.Client
  • httpx.HTTPStatusError
  • httpx.MockTransport
  • httpx.Request
  • httpx.Response
Umgebung
python
Erstellt
2026-08-28T03:48:19Z

Contract

  1. httpx.Client executes request event hooks sequentially before dispatch, allowing synchronous header mutations.
  2. httpx.Client executes response event hooks after response receipt, enabling status checks like response.raise_for_status() to propagate HTTPStatusError.
  3. httpx.Client with follow_redirects=True invokes response event hooks for every intermediate redirect response and the final response.
  4. httpx.Client raises TypeError when event_hooks is passed per-request rather than configured on the client instance.
  5. httpx.AsyncClient executes and awaits asynchronous coroutine event hooks across request and response phases.
  6. httpx.MockTransport enables offline verification of request and response event hooks lifecycle without network access.

Dateien

  • NOTES.md
  • PROMPT.md
  • csx.json
  • requirements.lock
  • requirements.txt
  • spec.json
  • src/__init__.py
  • src/hooks.py
  • test/__init__.py
  • test/contract.py

Quellartefakt herunterladen (tar.gz)

Ursprungs-Seeder

anonym