raise_for_status param in client constructor #3609
Unanswered
aeshna-cyanea
asked this question in
Ideas
Replies: 1 comment
|
This is already achievable with a response event hook, without adding a constructor flag: For AsyncClient the hook must be async: Response hooks run after the response headers are available and apply to every request made by that client. This is the documented use case: Event Hooks. If the hook also needs the error body, explicitly read it first (response.read() / await response.aread()) because a streamed response body may not have been consumed yet. A built-in boolean would still need to answer policy questions such as redirects, 4xx vs 5xx, streaming, and error-body parsing, while the hook expresses those choices directly. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
imo it would be convenient if we could tell the client to have raise_for_status() enabled by default on all requests when initializing it
All reactions