Skip to content

Cannot call raise_for_status as the request instance has not been set on this response. #3252

Discussion options

You must be logged in to vote

the problem was, I did some other error handling logic in a subclass client, which return a new httpx.Response

def handle_error(res: httpx.Response):
  return httpx.Response(...)

now doing below works

def handle_error(res: httpx.Response):
  return httpx.Response(..., request=res.request)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@DeoLeung
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by tomchristie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants