Skip to content

How to read response from http.client.HTTPResponse in response hook for URLLib instrumentation #3469

Answered by emdneto
nabheet asked this question in Q&A
Discussion options

You must be logged in to vote

In that case, you should buffer your response.read() and later restore it. This will happen even if not using the URLLibInstrumentor.

something like: response.read = lambda amt=None: io.BytesIO(body).read(amt)

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@nabheet
Comment options

@emdneto
Comment options

emdneto May 15, 2025
Collaborator

Answer selected by emdneto
@nabheet
Comment options

@emdneto
Comment options

emdneto May 15, 2025
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants