Post tweet with tweepy

Riccardo Gai picture Riccardo Gai · Oct 12, 2013 · Viewed 13.8k times · Source

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?

Answer

user2737086 picture user2737086 · Oct 12, 2013

In the application's settings, set your Application Type to "Read and Write". Then renegotiate your access token.