Log text of HTTP response when handling request error in BaseStream
authorHarmon <Harmon758@gmail.com>
Wed, 1 Jun 2022 13:26:08 +0000 (08:26 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 1 Jun 2022 13:26:38 +0000 (08:26 -0500)
tweepy/streaming.py

index 9ff3746ec2f645718c12b023b1806dfdc6b226b2..041f3eb8f2d887c8311f63f01669f23ebef762b8 100644 (file)
@@ -100,6 +100,13 @@ class BaseStream:
                             self.on_request_error(resp.status_code)
                             if not self.running:
                                 break
+                            # The error text is logged here instead of in
+                            # on_request_error to keep on_request_error
+                            # backwards-compatible. In a future version, the
+                            # Response should be passed to on_request_error.
+                            log.error(
+                                "HTTP error response text: %s", resp.text
+                            )
 
                             error_count += 1