From 4b48cb9ed5510c7b32e3f7cac7398979168794ac Mon Sep 17 00:00:00 2001 From: Dan Fairs Date: Sat, 4 Feb 2012 16:22:56 +0000 Subject: [PATCH] Provide a hook for subclasses to do something when a response closes. --- tweepy/streaming.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index 6f8b4a6..dd144aa 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -157,6 +157,8 @@ class Stream(object): # buffer buf += c + if resp.isclosed(): + self.on_closed(resp) def _start(self, async): self.running = True @@ -165,6 +167,10 @@ class Stream(object): else: self._run() + def on_closed(self, resp): + """ Called when the response has been closed by Twitter """ + pass + def userstream(self, count=None, async=False, secure=True): if self.running: raise TweepError('Stream object already connected!') -- 2.25.1