From 22a95028a184d3ae826ba35bb75fc69362c9d807 Mon Sep 17 00:00:00 2001 From: Harmon Date: Tue, 26 Jan 2021 09:22:43 -0600 Subject: [PATCH] Improve error messages in Stream.filter and Stream.sample --- tweepy/streaming.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index 834953e..ed70176 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -154,7 +154,7 @@ class Stream: filter_level=None, languages=None, stall_warnings=False, threaded=False): if self.running: - raise TweepError("Stream object already connected!") + raise TweepError("Stream is already connected") method = "POST" endpoint = "statuses/filter" @@ -167,8 +167,9 @@ class Stream: body["track"] = ','.join(track) if locations and len(locations) > 0: if len(locations) % 4: - raise TweepError("Wrong number of locations points, " - "it has to be a multiple of 4") + raise TweepError( + "Number of location coordinates should be a multiple of 4" + ) body["locations"] = ','.join(f"{l:.4f}" for l in locations) if filter_level: body["filter_level"] = filter_level @@ -185,7 +186,7 @@ class Stream: def sample(self, *, languages=None, stall_warnings=False, threaded=False): if self.running: - raise TweepError("Stream object already connected!") + raise TweepError("Stream is already connected") method = "GET" endpoint = "statuses/sample" -- 2.25.1