Skip to content
masterclass Buddy

HTTPX · Method

response.raise_for_status

Response.raise_for_status() checks an HTTP response status. It returns the response for 2xx results and raises httpx.HTTPStatusError for 4xx or 5xx results.

Last updated

Syntax

response.raise_for_status()

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • httpx.HTTPStatusError
  • httpx.HTTPError
  • httpx.RequestError
  • Response.status_code
  • Response.json

Source: QuickStart - HTTPX. Checked 2026-11-03.