From 5e06813723ad4b51c9390b415a0f12d428cbee9c Mon Sep 17 00:00:00 2001 From: Joshua Roesslein Date: Sat, 18 May 2013 23:58:26 -0700 Subject: [PATCH] Implement StreamListener.on_connect callback. --- tweepy/streaming.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index b1bb4b2..f6d37f4 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -22,6 +22,15 @@ class StreamListener(object): def __init__(self, api=None): self.api = api or API() + def on_connect(self): + """Called once connected to streaming server. + + This will be invoked once a successful response + is received from the server. Allows the listener + to perform some work prior to entering the read loop. + """ + pass + def on_data(self, data): """Called when raw data is received from connection. @@ -114,6 +123,7 @@ class Stream(object): sleep(self.retry_time) else: error_counter = 0 + self.listener.on_connect() self._read_loop(resp) except timeout: if self.listener.on_timeout() == False: -- 2.25.1