Rename StreamListener.keep_alive to StreamListener.on_keep_alive
authorHarmon <Harmon758@gmail.com>
Mon, 4 Jan 2021 10:11:22 +0000 (04:11 -0600)
committerHarmon <Harmon758@gmail.com>
Mon, 4 Jan 2021 10:11:22 +0000 (04:11 -0600)
To be consistent with other StreamListener methods

tweepy/streaming.py

index 062a274d808a64429acbf1dd636b504045b62dd2..bcd73313027e612400e96923d0995cc8ab7ca767 100644 (file)
@@ -66,7 +66,7 @@ class StreamListener:
 
         log.error("Unknown message type: %s", raw_data)
 
-    def keep_alive(self):
+    def on_keep_alive(self):
         """Called when a keep-alive arrived"""
         return
 
@@ -289,7 +289,7 @@ class Stream:
                 line = buf.read_line()
                 stripped_line = line.strip() if line else line  # line is sometimes None so we need to check here
                 if not stripped_line:
-                    self.listener.keep_alive()  # keep-alive new lines are expected
+                    self.listener.on_keep_alive()  # keep-alive new lines are expected
                 elif stripped_line.isdigit():
                     length = int(stripped_line)
                     break