From: Dan Fairs Date: Sat, 4 Feb 2012 16:22:56 +0000 (+0000) Subject: Provide a hook for subclasses to do something when a response closes. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4b48cb9ed5510c7b32e3f7cac7398979168794ac;p=tweepy.git Provide a hook for subclasses to do something when a response closes. --- 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!')