httpx.Response.elapsed cannot be accessed anymore
See original GitHub issueI have logging that reads request time from .elapsed
attribute of httpx.Request
. Everything works with 0.13, but after upgrading to 0.15 I’m getting exceptions:
'.elapsed' may only be accessed after the response has been read or closed.
My versions: httpx==0.21.1 pytest-httpx==0.15.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Advanced Usage - HTTPX
When accessing response.text , we need to decode the response bytes into a ... setting up HTTP proxies via the proxies parameter to...
Read more >QuickStart - HTTPX
In some cases the response may not contain an explicit encoding, ... The response content can also be accessed as bytes, for non-text...
Read more >Requests Compatibility - HTTPX
In HTTPX, event hooks may access properties of requests and responses, but event hook callbacks cannot mutate the original request/response. If you are...
Read more >Exceptions - HTTPX
try: response = httpx.get("https://www.example.com") response.raise_for_status() except httpx.HTTPError as exc: print(f"HTTP Exception for {exc.request.url} ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unfortunately, it was fixed only for add_response and still does not work for add_callback. I’ve proposed a fix -> https://github.com/Colin-b/pytest_httpx/pull/61
Thanks @mvbrn ,
Release 0.17.2 was performed today with your fix