Improve the options handling in the streaming.Stream class, so that false values...
authorRobin Houston <robin.houston@gmail.com>
Sat, 5 Mar 2011 15:41:16 +0000 (15:41 +0000)
committerRobin Houston <robin.houston@gmail.com>
Sat, 5 Mar 2011 15:41:16 +0000 (15:41 +0000)
tweepy/streaming.py

index 5ac12db346b7b5bd38044f592414d547738ffb56..f9797a034c637619f5dabb9c4e4dbd16fd559ec4 100644 (file)
@@ -71,11 +71,11 @@ class Stream(object):
         self.auth = auth
         self.listener = listener
         self.running = False
-        self.timeout = options.get("timeout") or 5.0
+        self.timeout = options.get("timeout", 5.0)
         self.retry_count = options.get("retry_count")
-        self.retry_time = options.get("retry_time") or 10.0
-        self.snooze_time = options.get("snooze_time") or 5.0
-        self.buffer_size = options.get("buffer_size") or 1500
+        self.retry_time = options.get("retry_time", 10.0)
+        self.snooze_time = options.get("snooze_time",  5.0)
+        self.buffer_size = options.get("buffer_size",  1500)
         if options.get("secure"):
             self.scheme = "https"
         else:
@@ -96,7 +96,7 @@ class Stream(object):
         conn = None
         exception = None
         while self.running:
-            if self.retry_count and error_counter > self.retry_count:
+            if self.retry_count is not None and error_counter > self.retry_count:
                 # quit if error count greater than retry count
                 break
             try: