From 3d51a65353dadc61abfd8ff7d821984cde81ec08 Mon Sep 17 00:00:00 2001 From: Sam Kaufman Date: Wed, 16 Jun 2010 14:26:14 +0800 Subject: [PATCH] Added filtering by locations to the streaming API. --- tweepy/streaming.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index 261fb11..30f5faa 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -180,7 +180,7 @@ class Stream(object): self.url += '&count=%s' % count self._start(async) - def filter(self, follow=None, track=None, async=False): + def filter(self, follow=None, track=None, async=False, locations=None): params = {} self.headers['Content-type'] = "application/x-www-form-urlencoded" if self.running: @@ -190,6 +190,9 @@ class Stream(object): params['follow'] = ','.join(map(str, follow)) if track: params['track'] = ','.join(map(str, track)) + if locations and len(locations) > 0: + assert len(locations) % 4 == 0 + params['locations'] = ','.join(map(str, locations)) self.body = urllib.urlencode(params) self._start(async) -- 2.25.1