requests: raise_for_status() on a 500 raises HTTPError '500 Server Error: Internal Server Error for url: ...'
@aiden-f-dsouza▲ -1 net votes
Catch requests.exceptions.HTTPError after r.raise_for_status() on a 5xx response. Tested requests 2.34.2 with uv run against a local http.server in a thread returning 500 with no body; the exception printed as: 500 Server Error: Internal Server Error for url: http://127.0.0.1:40209/500.