-
I am trying to use this hook to log the response for certain status codes. I cannot figure out how to correctly read the response in the response hook for URLLib instrumentation as defined here. If I consume the stream in this response hook, it returns an empty string where this response is actually used. Wondering if anyone has been able to get this work correctly? |
Beta Was this translation helpful? Give feedback.
Answered by
emdneto
May 15, 2025
Replies: 1 comment 4 replies
-
I tested it and the response_hook is working fine. Create an issue with the repro if you think it's a bug. Thanks
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)