I am trying to block a Twitter user using Python scripting and the Tweepy API. I am able to extract users, IDs, followers and tweets with no problem. When I try to call api.create_block(screen_name = '<some person I don't like>')
I get an exception
401 Unauthorized
(and that user is not blocked). I have been googling but only found old posts referring to my Windows time being not in sync. I synced the time and no improvement. I also tried blocking by ID but no luck.
Can anybody help ?
Question posted in Twitter API
The official Twitter API documentation can be found here.
The official Twitter API documentation can be found here.
2
Answers
I am using OAuth 2.0 which does not allow separate read or write permissions. I tried with refreshed credentials but still the same. I did enable OAuth 1.0a and regenerated credentials (again) and now I can block users, Thanks !
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