Filtering using locations in Tweepy


#1

I often stream tweets by location using tweepy. However recently I tried filtering using the following coordinates which started giving 406 error.

[-70.9290866,41.62536793,-70.9207976,41.63217193]

Is there any invalid or illegal coordinates for this parameter??

Thanks


#2

Has anybody done retrieval of tweets based on locations using tweepy? if so, please let me know. I m in urgent need of your help. when i trying it for the first time i am getting 406 error and plz tell me how to resolve this error?

Thank You!


#3

406 indicates the following kind of error:

406, Not Acceptable, Returned by the Search API when an invalid format is specified in the request.

Check if the authorization details have been entered correctly. Then check the format in which you have given the coordinates.
Its in the following format:

[SWlongitude, SWLatitude, NElongitude, NELatitude]

example:
twitterStream.filter(locations=[-70.93044414,41.65536809,-70.9231071,41.66316909])

This will stream tweets from the region enclosed by the above coordinates.


#4

Hi, is there any way to filter tweets from multiple locations at the same time? For example, can I extract Tweets from Los Angeles and Las Vegas using the same “locations” filter? I can already filter Tweets from Los Angeles, but I was wondering if I could expand on that. Thank you!


#5

Yes, see https://dev.twitter.com/docs/streaming-apis/parameters#locations - you can add additional sets of bounding box parameters to the search/filter endpoint.