0

So, I was trying to like a Tweet using Tweepy, but this error is occurring:

Traceback (most recent call last):
  File "c:/Users/User/Desktop/VScode/Python/FibraBot_home/bottwitter2.py", line 32, in <module>
    tweet.favorite()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tweepy\models.py", line 371, in favorite    
    return self._api.create_favorite(self.id)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tweepy\api.py", line 46, in wrapper
    return method(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tweepy\api.py", line 913, in create_favorite
    ), id=id, **kwargs
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tweepy\api.py", line 257, in request        
    raise Unauthorized(resp)
tweepy.errors.Unauthorized: 401 Unauthorized
PS C:\Users\User\Desktop\VScode\Python\FibraBot_home> 

Any ideas?

Harmon758
  • 5,084
  • 3
  • 22
  • 39
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 28 '22 at 13:13
  • check [this out](https://stackoverflow.com/questions/28412683/401-error-when-retrieving-twitter-data-using-tweepy) – sensualbumfuzzle Apr 28 '22 at 16:09

1 Answers1

0

If you’re using a method that performs an action on behalf of the authenticating user, e.g. API.update_status(), make sure your app has the write permission.

After giving it the write permission, make sure to regenerate and use new credentials to utilize it.

https://tweepy.readthedocs.io/en/v4.8.0/faq.html#why-am-i-encountering-a-401-unauthorized-error-with-api-or-403-forbidden-error-with-client

Harmon758
  • 5,084
  • 3
  • 22
  • 39