The Fix
Upgrade to version 0.7.3 or later.
Based on closed encode/httpx issue #338 · PR/commit linked
@@ -59,6 +59,11 @@
* `.cookies` - **Cookies**
* `.history` - **List[Response]**
+* `.elapsed` - **[timedelta](https://docs.python.org/3/library/datetime.html)**
+ * The amount of time elapsed between sending the first byte and parsing the headers (not including time spent reading
+ the response). Use
Option A — Upgrade to fixed release\nUpgrade to version 0.7.3 or later.\nWhen NOT to use: This fix is not suitable if precise timing breakdowns are required beyond elapsed time.\n\n
Why This Fix Works in Production
- Trigger: Missing requests' elapsed property on Response object.
- Mechanism: The httpx Response object lacked an elapsed property to track request duration
- Why the fix works: Adds the `.elapsed` property to Response objects, allowing users to track how long a request took, addressing issue #338. (first fixed release: 0.7.3).
Why This Breaks in Prod
- The httpx Response object lacked an elapsed property to track request duration
- Production symptom (often without a traceback): Missing requests' elapsed property on Response object.
Proof / Evidence
- GitHub issue: #338
- Fix PR: https://github.com/encode/httpx/pull/351
- First fixed release: 0.7.3
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.70
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“I can take a crack at this! This project looks super interesting and looking to get started.”
“Yup, I remember I had identified this discrepency in https://github.com/encode/httpx/pull/298 already”
Failure Signature (Search String)
- Missing requests' elapsed property on Response object.
- The requests Response object has an elapsed property which returns a datetime.timedelta instance. This appears to be missing from the httpx Response.
Copy-friendly signature
Failure Signature
-----------------
Missing requests' elapsed property on Response object.
The requests Response object has an elapsed property which returns a datetime.timedelta instance. This appears to be missing from the httpx Response.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Missing requests' elapsed property on Response object.
The requests Response object has an elapsed property which returns a datetime.timedelta instance. This appears to be missing from the httpx Response.
What Broke
Users could not measure the time taken for requests, impacting performance analysis.
Why It Broke
The httpx Response object lacked an elapsed property to track request duration
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.7.3 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/encode/httpx/pull/351
First fixed release: 0.7.3
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not suitable if precise timing breakdowns are required beyond elapsed time.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
- Upgrade behind a canary and run integration tests against the canary before 100% rollout.
- Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
- Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.7.3 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.