From: Robin Houston Date: Sat, 5 Mar 2011 15:41:16 +0000 (+0000) Subject: Improve the options handling in the streaming.Stream class, so that false values... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2ff2c641979a1a0d2fc62f5becfc9370f250d45c;p=tweepy.git 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.) --- 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: