From 51c37626b76b40693cc033fec7c71d56090f7135 Mon Sep 17 00:00:00 2001 From: Harmon Date: Fri, 16 Sep 2022 11:44:07 -0500 Subject: [PATCH] Log text of HTTP response when handling request error in AsyncBaseStream --- tweepy/asynchronous/streaming.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tweepy/asynchronous/streaming.py b/tweepy/asynchronous/streaming.py index 0f374c0..3b3f28d 100644 --- a/tweepy/asynchronous/streaming.py +++ b/tweepy/asynchronous/streaming.py @@ -81,6 +81,15 @@ class AsyncBaseStream: await self.on_closed(resp) else: await self.on_request_error(resp.status) + # The error text is logged here instead of in + # on_request_error to keep on_request_error + # backwards-compatible. In a future version, the + # ClientResponse should be passed to + # on_request_error. + response_text = await resp.text() + log.error( + "HTTP error response text: %s", response_text + ) error_count += 1 -- 2.25.1