Reputation: 21
I'm making a twitter bot to like tweets and at first the script is right. The problem is with the twitter API permission. It says "Read only" and there is no option to change it, as in the past. Anyone had the same problem? Always returns on console: "Read-only application cannot POST" Here is the script:
import tweepy
bearer_token = 'xxxxxxxxxx'
consumer_key = 'xxxxxxxxxxx'
consumer_secret = 'xxxxxxxxxxxx'
access_token = 'xxxxxxxxxxxxx'
access_token_secret = 'xxxxxxxxxxxxxxx'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
class MyStreamListener(tweepy.StreamListener):
def on_status(self, tweet):
# print("Tweet Found!")
# print (f"{tweet.author.screen_name} - {tweet.text}")
if tweet.in_reply_to_status_id is None and not tweet.favorited:
try:
print("Attempting like...")
api.create_favorite(tweet.id)
print("Tweet successfully liked :)")
except Exception as err:
print(err)
stream_listener = MyStreamListener()
stream = tweepy.Stream(auth=api.auth,listener=stream_listener)
stream.filter(track=["#NFTCommunity", "NFTCommunityCryptoArt"], languages=["en"])
Upvotes: 1
Views: 904
Reputation:
As posted here.
In the developer portal:
You will now need to select the Keys and tokens tab under the app settings, and Generate Access token and Secret, in order for them to have the new permissions.
(if this resolves your issue please mark this as the solution)
Upvotes: 2