I'm trying to post a tweet with the tweepy library. I use this code:
import tweepy
CONSUMER_KEY ="XXXX"
CONSUMER_SECRET = "XXXX"
ACCESS_KEY = "XXXX"
ACCESS_SECRET = "XXXX"
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)
api.update_status('Updating using OAuth authentication via Tweepy!')
But when I run the application, I receive this error:
raise TweepError(error_msg, resp)
TweepError: Read-only application cannot POST.
How can I fix this?
First, log in to the Twitter developer's portal with the account from which you want to post a tweet. Then click on the "Developer Portal" link in the upper right corner. Once you enter it, click on "Projects & Apps" -> "Overview" -> "Create App".
Deprecated since version 4.10: The Twitter API v1. 1 endpoint this method uses is now deprecated and will be retired on October 29, 2022.
Send a tweet from PythonSave the file as auth.py . Save this file as twitter.py . This uses the API's update_status() function to send a tweet containing the text “Hello world!”. Now save ( Ctrl + S ) and run with F5 .
Tweepy provides the convenient Cursor interface to iterate through different types of objects. Twitter allows a maximum of 3200 tweets for extraction.
In the application's settings, set your Application Type to "Read and Write". Then renegotiate your access token.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With