I am trying to download the people that is twitting certain words in an area by this python code:
import sys
import tweepy
consumer_key="LxxxxxxxxxxxxxxxTY"
consumer_secret="Lqxxxxxxxxxxxxxxxnd"
access_key="31xxxxxxxxxxxxxxxaQTyx"
access_secret="fOxxxxxxxxxxxxxxxwC"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api = tweepy.API(auth)
class CustomStreamListener(tweepy.StreamListener):
def on_status(self, status):
if 'busco casa' in status.text.lower():
print (status.text)
def on_error(self, status_code):
print (sys.stderr, 'Encountered error with status code:', status_code)
return True # Don't kill the stream
def on_timeout(self):
print (sys.stderr, 'Timeout...')
return True # Don't kill the stream
sapi = tweepy.streaming.Stream(auth, CustomStreamListener())
sapi.filter(locations=[-78.37,-0.20,-78.48,-0.18])
I am getting this error:
<ipykernel.iostream.OutStream object at 0x000001F4741034A8> Encountered error with status code: 401
I read in this link https://dev.twitter.com/overview/api/response-codes that the error is caused by:
Authentication credentials were missing or incorrect.
Also returned in other circumstances, for example all calls to API v1 endpoints now return 401 (use API v1.1 instead).
The authentication is there with updated keys. How should I use API v1.1?