From e5b8d900db6219e35e390df1045f8cfaec6ea950 Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" Date: Sat, 8 Feb 2025 08:16:33 +0100 Subject: [PATCH] docs: add a tip to use event hooks for `raise_for_status` --- docs/quickstart.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/quickstart.md b/docs/quickstart.md index 38da2fec36..fee5658af5 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -305,6 +305,9 @@ The method returns the response instance, allowing you to use it inline. For exa >>> data = httpx.get('...').raise_for_status().json() ``` +!!! tip + If you want `raise_for_status()` to be always called after **every** request, use a [`Client` instance](advanced/clients.md) with an [event hook](advanced/event-hooks.md) like `httpx.Client(event_hooks={"response": [Response.raise_for_status]})` instead of the top-level interface. + ## Response Headers The response headers are available as a dictionary-like interface.