Handling message "friends" on streaming.
authorkjwon15 <kjwonmail@gmail.com>
Sun, 10 Aug 2014 17:56:21 +0000 (02:56 +0900)
committerkjwon15 <kjwonmail@gmail.com>
Sun, 10 Aug 2014 18:00:27 +0000 (03:00 +0900)
tweepy/streaming.py

index 4d6c4fa2267a9c458a27293c50bfd2ca99664ce7..a444e278d244b4e2c7c2961525cd887fcdb1ae64 100644 (file)
@@ -58,6 +58,9 @@ class StreamListener(object):
             status = Status.parse(self.api, data)
             if self.on_direct_message(status) is False:
                 return False
+        elif 'friends' in data:
+            if self.on_friends(data['friends']) is False:
+                return False
         elif 'limit' in data:
             if self.on_limit(data['limit']['track']) is False:
                 return False
@@ -87,6 +90,13 @@ class StreamListener(object):
         """Called when a new direct message arrives"""
         return
 
+    def on_friends(self, friends):
+        """Called when a friends list arrives.
+
+        friends is a list that contains user_id
+        """
+        return
+
     def on_limit(self, track):
         """Called when a limitation notice arrvies"""
         return