0

I'm trying to retrieve the most recent tweets or all tweets with tweepy. All the keys and tokens from the twitter app are already defined also the permissions needed for the access to the app, but I'm still gettin this Unatorizhed error

Traceback (most recent call last):
  File "/home/marco/Área de Trabalho/python/Exercícios/Básicos/Teste.py", line 18, in <module>
    response = api.search_all_tweets(query="covid", max_results=10)
  File "/home/marco/.local/lib/python3.10/site-packages/tweepy/client.py", line 1163, in search_all_tweets
    return self._make_request(
  File "/home/marco/.local/lib/python3.10/site-packages/tweepy/client.py", line 129, in _make_request
    response = self.request(method, route, params=request_params,
  File "/home/marco/.local/lib/python3.10/site-packages/tweepy/client.py", line 98, in request
    raise Unauthorized(response)
tweepy.errors.Unauthorized: 401 Unauthorized
Unauthorized

My code

auth = tweepy.OAuthHandler(CONSUMER_KEY,CONSUMER_SECRET)

auth.set_access_token(OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
api = tweepy.Client(CONSUMER_KEY,CONSUMER_SECRET,OAUTH_TOKEN,OAUTH_TOKEN_SECRET,BEARER_TOKEN)

response = api.search_all_tweets(query="covid", max_results=10)
for tweet in response.data:
    print(tweet.text)

This is how the permissions are set

enter image description here

0 Answers0