We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 247b02f commit 5e06813Copy full SHA for 5e06813
tweepy/streaming.py
@@ -22,6 +22,15 @@ class StreamListener(object):
22
def __init__(self, api=None):
23
self.api = api or API()
24
25
+ def on_connect(self):
26
+ """Called once connected to streaming server.
27
+
28
+ This will be invoked once a successful response
29
+ is received from the server. Allows the listener
30
+ to perform some work prior to entering the read loop.
31
+ """
32
+ pass
33
34
def on_data(self, data):
35
"""Called when raw data is received from connection.
36
@@ -114,6 +123,7 @@ def _run(self):
114
123
sleep(self.retry_time)
115
124
else:
116
125
error_counter = 0
126
+ self.listener.on_connect()
117
127
self._read_loop(resp)
118
128
except timeout:
119
129
if self.listener.on_timeout() == False:
0 commit comments