From: Sam Kaufman Date: Wed, 16 Jun 2010 06:26:14 +0000 (+0800) Subject: Added filtering by locations to the streaming API. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3d51a65353dadc61abfd8ff7d821984cde81ec08;p=tweepy.git Added filtering by locations to the streaming API. --- 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)