Only call _data if stream.running=True
authorAris Pikeas <pikeas@gmail.com>
Thu, 3 Apr 2014 23:43:45 +0000 (16:43 -0700)
committerAris Pikeas <pikeas@gmail.com>
Thu, 3 Apr 2014 23:43:45 +0000 (16:43 -0700)
Not sure why an extra delimiter int is spit out when you disconnect, but this should be enough of a bandaid.

tweepy/streaming.py

index be233ffe0ef158bf7fa732976b2abfe6c18285f9..b37d0edf3f510231087fb807ed270077b87ab4e4 100644 (file)
@@ -223,7 +223,8 @@ class Stream(object):
             # read the next twitter status object
             if delimited_string.strip().isdigit():
                 next_status_obj = resp.read( int(delimited_string) )
-                self._data(next_status_obj)
+                if self.running:
+                    self._data(next_status_obj)
 
         if resp.isclosed():
             self.on_closed(resp)