Skip to content

Commit 5b76b36

Browse files
committed
Merge pull request tweepy#505 from joausaga/master
Modify on_data method of StreamListener to process warning messages
2 parents 3a44f13 + 827b767 commit 5b76b36

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tweepy/streaming.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def on_data(self, raw_data):
6868
elif 'disconnect' in data:
6969
if self.on_disconnect(data['disconnect']) is False:
7070
return False
71+
elif 'warning' in data:
72+
if self.on_warning(data['warning']) is False:
73+
return False
7174
else:
7275
logging.error("Unknown message type: " + str(raw_data))
7376

@@ -99,7 +102,7 @@ def on_friends(self, friends):
99102
return
100103

101104
def on_limit(self, track):
102-
"""Called when a limitation notice arrvies"""
105+
"""Called when a limitation notice arrives"""
103106
return
104107

105108
def on_error(self, status_code):
@@ -117,6 +120,10 @@ def on_disconnect(self, notice):
117120
https://dev.twitter.com/docs/streaming-apis/messages#Disconnect_messages_disconnect
118121
"""
119122
return
123+
124+
def on_warning(self, notice):
125+
"""Called when a disconnection warning message arrives"""
126+
return
120127

121128

122129
class ReadBuffer(object):

0 commit comments

Comments
 (0)