From: Harmon Date: Fri, 16 Sep 2022 16:44:07 +0000 (-0500) Subject: Log text of HTTP response when handling request error in AsyncBaseStream X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=51c37626b76b40693cc033fec7c71d56090f7135;p=tweepy.git Log text of HTTP response when handling request error in AsyncBaseStream --- 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