stream.filter(locations=[-122.75,36.8,-121.75,37.8,-74,40,-73,41],track=["twitpic"])
Cela fonctionne. Cependant, ce n'est pas "ET". C'est "OU". Cette ligne obtient l'emplacement OU le mot-clé. Comment le rendre "ET"?Comment utiliser l'API de streaming Twitter?
Voici le code à la bibliothèque que je utilise:
def filter(self, follow=None, track=None, async=False, locations=None):
self.parameters = {}
self.headers['Content-type'] = "application/x-www-form-urlencoded"
if self.running:
raise TweepError('Stream object already connected!')
self.url = '/%i/statuses/filter.json?delimited=length' % STREAM_VERSION
if follow:
self.parameters['follow'] = ','.join(map(str, follow))
if track:
self.parameters['track'] = ','.join(map(str, track))
if locations and len(locations) > 0:
assert len(locations) % 4 == 0
self.parameters['locations'] = ','.join(['%.2f' % l for l in locations])
self.body = urllib.urlencode(self.parameters)
self.parameters['delimited'] = 'length'
self._start(async)
https://github.com/joshthecoder/tweepy/blob/master/tweepy/streaming.py