From 2ff2c641979a1a0d2fc62f5becfc9370f250d45c Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Sat, 5 Mar 2011 15:41:16 +0000 Subject: [PATCH] Improve the options handling in the streaming.Stream class, so that false values can be used. (In particular I want to be able to pass timeout=None, but one might also reasonably want to pass zero for some of the other options.) --- tweepy/streaming.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index 5ac12db..f9797a0 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -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: -- 2.25.1