CodeSampleX

Beispiel

httpx 0.28.1: Configure httpx timeouts across connect, read, write, and pool phases without falling for requests-style unbounded defaults, partial kwarg ValueError traps, or 2-tuple unlimited-write surprises

Verifiziertes Beispiel für pypi httpx 0.28.1: Configure httpx timeouts across connect, read, write, and pool phases without falling for requests-style…

sha256:1ddf2062ed8d42a754be36dfc77a7d14fc9f7b8e095bca0e0a8323388c1e63dd

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
2
Signaturschlüssel, die es gebaut haben
2
Deklarierte Umgebung python linux x64 python python pip

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
python 3.12 · linux alpine/x64 · docker ed25519:ac1544ece1e22594 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-15
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-18

Fall

HOW
Ziel
Configure httpx timeouts across connect, read, write, and pool phases without falling for requests-style unbounded defaults, partial kwarg ValueError traps, or 2-tuple unlimited-write surprises
Pakete
Symbole
  • httpx.Timeout
  • httpx.Client
  • httpx.ConnectTimeout
  • httpx.ReadTimeout
  • httpx.WriteTimeout
  • httpx.PoolTimeout
  • httpx.TimeoutException
  • httpx.USE_CLIENT_DEFAULT
Umgebung
python
Erstellt
2026-08-15T08:26:26Z

Contract

  1. assert httpx.Client default timeout is 5.0 seconds across all 4 phases (connect, read, write, pool), unlike requests which defaults to None
  2. assert httpx.Timeout() with no arguments raises ValueError rather than returning the 5.0 default configuration
  3. assert httpx.Timeout(read=10.0) raises ValueError without a positional default argument or all four explicit kwargs
  4. assert httpx.Timeout(5.0, read=10.0) sets read to 10.0 and keeps connect, write, and pool at 5.0
  5. assert passing a 2-tuple (connect, read) sets write and pool to None (unlimited), not 5.0
  6. assert passing a 4-tuple sets connect, read, write, and pool in explicit positional order
  7. assert timeout=None at the request level explicitly disables all timeouts even when the client has a positive timeout configured
  8. assert request.extensions['timeout'] carries the resolved 4-phase dictionary into the transport layer
  9. assert ConnectTimeout, ReadTimeout, WriteTimeout, and PoolTimeout all subclass TimeoutException and RequestError, but not HTTPStatusError

Dateien

  • NOTES.md
  • csx.json
  • requirements.lock
  • requirements.txt
  • src/__init__.py
  • src/timeouts.py
  • test/__init__.py
  • test/contract.py

Quellartefakt herunterladen (tar.gz)

Ursprungs-Seeder

anonymous